summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Fauth2013-11-28 07:39:35 (EST)
committer Dirk Fauth2013-11-29 15:46:03 (EST)
commitfbc28885dd1a3d35ff80467aab7437d22e1328b9 (patch)
treeb48f7012de5292efa0e0c046bd78a5d5e8f53f18
parent6a246a07d7060f4f85c2c2a1db3736dc0f4adeec (diff)
downloadeclipse.platform.runtime-fbc28885dd1a3d35ff80467aab7437d22e1328b9.zip
eclipse.platform.runtime-fbc28885dd1a3d35ff80467aab7437d22e1328b9.tar.gz
eclipse.platform.runtime-fbc28885dd1a3d35ff80467aab7437d22e1328b9.tar.bz2
Bug 422881 - Added additional test cases for the new message extensionrefs/changes/50/19150/1
Change-Id: I728529ae8a17dc17440e2f7d9bcbfadd53e2fb0a Signed-off-by: Dirk Fauth <dirk.fauth@googlemail.com>
-rw-r--r--tests/org.eclipse.e4.core.tests/OSGI-INF/l10n/bundle.properties7
-rw-r--r--tests/org.eclipse.e4.core.tests/OSGI-INF/l10n/bundle_de.properties5
-rw-r--r--tests/org.eclipse.e4.core.tests/resources/another.properties6
-rw-r--r--tests/org.eclipse.e4.core.tests/resources/another_de.properties5
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/BundleMessages.java31
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/Messages.java35
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/NLSTest.java580
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/ResourceBundleClass.java7
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/ResourceBundleClassMessages.java31
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/ResourceBundleClass_de.java16
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/ResourcesMessages.java37
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/SimpleMessages.java31
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/SimpleMessages.properties7
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/SimpleMessages_de.properties5
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/messages.properties6
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/messages_de.properties5
16 files changed, 799 insertions, 15 deletions
diff --git a/tests/org.eclipse.e4.core.tests/OSGI-INF/l10n/bundle.properties b/tests/org.eclipse.e4.core.tests/OSGI-INF/l10n/bundle.properties
index fa34c8c..7b81b1e 100644
--- a/tests/org.eclipse.e4.core.tests/OSGI-INF/l10n/bundle.properties
+++ b/tests/org.eclipse.e4.core.tests/OSGI-INF/l10n/bundle.properties
@@ -1 +1,6 @@
-message_1=BundleMessages 1 \ No newline at end of file
+message=BundleMessage
+message_one=BundleMessageUnderscore
+messageOne=BundleMessageCamelCase
+message.two=BundleMessageUnderscoreDot
+message.three=BundleMessageCamelCaseDot
+message.four=The idea is from {0} \ No newline at end of file
diff --git a/tests/org.eclipse.e4.core.tests/OSGI-INF/l10n/bundle_de.properties b/tests/org.eclipse.e4.core.tests/OSGI-INF/l10n/bundle_de.properties
new file mode 100644
index 0000000..c307145
--- /dev/null
+++ b/tests/org.eclipse.e4.core.tests/OSGI-INF/l10n/bundle_de.properties
@@ -0,0 +1,5 @@
+message=BundleNachricht
+message_one=BundleNachrichtUnderscore
+messageOne=BundleNachrichtCamelCase
+message.two=BundleNachrichtUnderscoreDot
+message.four=Die Idee ist von {0} \ No newline at end of file
diff --git a/tests/org.eclipse.e4.core.tests/resources/another.properties b/tests/org.eclipse.e4.core.tests/resources/another.properties
new file mode 100644
index 0000000..28bb5b6
--- /dev/null
+++ b/tests/org.eclipse.e4.core.tests/resources/another.properties
@@ -0,0 +1,6 @@
+message=ResourcesMessage
+message_one=ResourcesMessageUnderscore
+messageOne=ResourcesMessageCamelCase
+message.two=ResourcesMessageUnderscoreDot
+message.three=ResourcesMessageCamelCaseDot
+message.four=The idea is from {0} \ No newline at end of file
diff --git a/tests/org.eclipse.e4.core.tests/resources/another_de.properties b/tests/org.eclipse.e4.core.tests/resources/another_de.properties
new file mode 100644
index 0000000..cd71cc6
--- /dev/null
+++ b/tests/org.eclipse.e4.core.tests/resources/another_de.properties
@@ -0,0 +1,5 @@
+message=ResourceNachricht
+message_one=ResourceNachrichtUnderscore
+messageOne=ResourceNachrichtCamelCase
+message.two=ResourceNachrichtUnderscoreDot
+message.four=Die Idee ist von {0} \ No newline at end of file
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/BundleMessages.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/BundleMessages.java
index f215494..ff960e4 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/BundleMessages.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/BundleMessages.java
@@ -1,5 +1,34 @@
package org.eclipse.e4.core.internal.tests.nls;
+import java.text.MessageFormat;
+
+import javax.annotation.PostConstruct;
+
+/**
+ * Load messages from the OSGi resource bundle (OSGI-INF/l10n/bundle.properties)
+ */
public class BundleMessages {
- public String message_1;
+
+ //message as is
+ public String message;
+
+ //message as is with underscore
+ public String message_one;
+
+ //message as is camel cased
+ public String messageOne;
+
+ //message with underscore transformed to . separated properties key
+ public String message_two;
+
+ //camel cased message transformed to . separated properties key
+ public String messageThree;
+
+ //message with placeholder
+ public String messageFour;
+
+ @PostConstruct
+ public void format() {
+ messageFour = MessageFormat.format(messageFour, "Tom"); //$NON-NLS-1$
+ }
}
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/Messages.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/Messages.java
new file mode 100644
index 0000000..d456c76
--- /dev/null
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/Messages.java
@@ -0,0 +1,35 @@
+package org.eclipse.e4.core.internal.tests.nls;
+
+import java.text.MessageFormat;
+
+import javax.annotation.PostConstruct;
+
+/**
+ * Load messages from a relative positioned resource bundle (./messages.properties)
+ * Used to verify the case sensitive filename handling under Linux
+ */
+public class Messages {
+
+ //message as is
+ public String message;
+
+ //message as is with underscore
+ public String message_one;
+
+ //message as is camel cased
+ public String messageOne;
+
+ //message with underscore transformed to . separated properties key
+ public String message_two;
+
+ //camel cased message transformed to . separated properties key
+ public String messageThree;
+
+ //message with placeholder
+ public String messageFour;
+
+ @PostConstruct
+ public void format() {
+ messageFour = MessageFormat.format(messageFour, "Tom"); //$NON-NLS-1$
+ }
+}
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/NLSTest.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/NLSTest.java
index 3dad3b5..f03a79c 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/NLSTest.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/NLSTest.java
@@ -1,5 +1,7 @@
package org.eclipse.e4.core.internal.tests.nls;
+import java.util.Locale;
+
import javax.inject.Inject;
import junit.framework.TestCase;
@@ -9,6 +11,7 @@ import org.eclipse.e4.core.contexts.EclipseContextFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.internal.tests.CoreTestsActivator;
import org.eclipse.e4.core.services.nls.Translation;
+import org.eclipse.e4.core.services.translation.TranslationService;
public class NLSTest extends TestCase {
static class TestSimpleObject {
@@ -17,6 +20,12 @@ public class NLSTest extends TestCase {
SimpleMessages simpleMessages;
}
+ static class TestMessagesObject {
+ @Inject
+ @Translation
+ Messages Messages;
+ }
+
static class TestBundleObject {
@Inject
@Translation
@@ -29,6 +38,12 @@ public class NLSTest extends TestCase {
ResourceBundleClassMessages bundleClassMessages;
}
+ static class TestResourcesBundleObject {
+ @Inject
+ @Translation
+ ResourcesMessages resourcesMessages;
+ }
+
private IEclipseContext context;
private IEclipseContext getOrCreateContext() {
@@ -40,24 +55,571 @@ public class NLSTest extends TestCase {
return context;
}
- public void testSimple() {
+ public void testSimpleMessages() {
+ //ensure the en Locale is set for this test
+ getOrCreateContext().set(TranslationService.LOCALE, "en");
+ TestSimpleObject o = ContextInjectionFactory.make(TestSimpleObject.class, getOrCreateContext());
+
+ //test all values are set
+ assertNotNull(o.simpleMessages);
+ assertNotNull(o.simpleMessages.message);
+ assertNotNull(o.simpleMessages.message_one);
+ assertNotNull(o.simpleMessages.messageOne);
+ assertNotNull(o.simpleMessages.message_two);
+ assertNotNull(o.simpleMessages.messageThree);
+ assertNotNull(o.simpleMessages.messageFour);
+
+ //test the set values
+ assertEquals("SimpleMessage", o.simpleMessages.message);
+ assertEquals("SimpleMessageUnderscore", o.simpleMessages.message_one);
+ assertEquals("SimpleMessageCamelCase", o.simpleMessages.messageOne);
+ assertEquals("SimpleMessageUnderscoreDot", o.simpleMessages.message_two);
+ assertEquals("SimpleMessageCamelCaseDot", o.simpleMessages.messageThree);
+ assertEquals("The idea is from Tom", o.simpleMessages.messageFour);
+ }
+
+ public void testSimpleMessagesDifferentLocale() {
+ //set Locale to de
+ getOrCreateContext().set(TranslationService.LOCALE, "de");
+ TestSimpleObject o = ContextInjectionFactory.make(TestSimpleObject.class, getOrCreateContext());
+
+ //test all values are set
+ assertNotNull(o.simpleMessages);
+ assertNotNull(o.simpleMessages.message);
+ assertNotNull(o.simpleMessages.message_one);
+ assertNotNull(o.simpleMessages.messageOne);
+ assertNotNull(o.simpleMessages.message_two);
+ assertNotNull(o.simpleMessages.messageThree);
+ assertNotNull(o.simpleMessages.messageFour);
+
+ //test the set values
+ assertEquals("SimpleNachricht", o.simpleMessages.message);
+ assertEquals("SimpleNachrichtUnderscore", o.simpleMessages.message_one);
+ assertEquals("SimpleNachrichtCamelCase", o.simpleMessages.messageOne);
+ assertEquals("SimpleNachrichtUnderscoreDot", o.simpleMessages.message_two);
+ //for messageThree there is no key specified in de properties file, so there should be the fallback
+ assertEquals("SimpleMessageCamelCaseDot", o.simpleMessages.messageThree);
+ assertEquals("Die Idee ist von Tom", o.simpleMessages.messageFour);
+ }
+
+ public void testSimpleMessagesSkipDefaultLocaleForEquinoxRoot() {
+ Locale defaultLocaleBefore = Locale.getDefault();
+ //change the default Locale for this testcase
+ Locale.setDefault(new Locale("de"));
+
+ //set the locale to en
+ //as there is no _en properties file, by default the _de properties file would be loaded and we would
+ //get german translations as the default locale is set to "de_DE"
+ //with checking the equinox.root.locale in the system properties the fallback is skipped as it tells
+ //that the root properties file is for locale en.
+ getOrCreateContext().set(TranslationService.LOCALE, "en");
+ TestSimpleObject o = ContextInjectionFactory.make(TestSimpleObject.class, getOrCreateContext());
+
+ //test all values are set
+ assertNotNull(o.simpleMessages);
+ assertNotNull(o.simpleMessages.message);
+ assertNotNull(o.simpleMessages.message_one);
+ assertNotNull(o.simpleMessages.messageOne);
+ assertNotNull(o.simpleMessages.message_two);
+ assertNotNull(o.simpleMessages.messageThree);
+ assertNotNull(o.simpleMessages.messageFour);
+
+ //not the default resource bundle should be used (e.g. de when running on a machine with german OS)
+ //but the default resource bundle
+ assertEquals("SimpleMessage", o.simpleMessages.message);
+ assertEquals("SimpleMessageUnderscore", o.simpleMessages.message_one);
+ assertEquals("SimpleMessageCamelCase", o.simpleMessages.messageOne);
+ assertEquals("SimpleMessageUnderscoreDot", o.simpleMessages.message_two);
+ assertEquals("SimpleMessageCamelCaseDot", o.simpleMessages.messageThree);
+ assertEquals("The idea is from Tom", o.simpleMessages.messageFour);
+
+ //reset the default locale
+ Locale.setDefault(defaultLocaleBefore);
+ }
+
+ public void testSimpleMessagesUseDefaultLocaleForInvalidLocale() {
+ Locale defaultLocaleBefore = Locale.getDefault();
+ //change the default Locale for this testcase
+ Locale.setDefault(new Locale("de"));
+
+ //set a locale for which no resource bundle is set
+ getOrCreateContext().set(TranslationService.LOCALE, "fr");
TestSimpleObject o = ContextInjectionFactory.make(TestSimpleObject.class, getOrCreateContext());
+
+ //test all values are set
assertNotNull(o.simpleMessages);
- assertNotNull(o.simpleMessages.message_1);
- assertEquals("SimpleMessages 1", o.simpleMessages.message_1);
+ assertNotNull(o.simpleMessages.message);
+ assertNotNull(o.simpleMessages.message_one);
+ assertNotNull(o.simpleMessages.messageOne);
+ assertNotNull(o.simpleMessages.message_two);
+ assertNotNull(o.simpleMessages.messageThree);
+ assertNotNull(o.simpleMessages.messageFour);
+
+ //the default resource bundle should be used
+ assertEquals("SimpleNachricht", o.simpleMessages.message);
+ assertEquals("SimpleNachrichtUnderscore", o.simpleMessages.message_one);
+ assertEquals("SimpleNachrichtCamelCase", o.simpleMessages.messageOne);
+ assertEquals("SimpleNachrichtUnderscoreDot", o.simpleMessages.message_two);
+ //for messageThree there is no key specified in de properties file, so there should be the fallback
+ assertEquals("SimpleMessageCamelCaseDot", o.simpleMessages.messageThree);
+ assertEquals("Die Idee ist von Tom", o.simpleMessages.messageFour);
+
+ //reset the default locale
+ Locale.setDefault(defaultLocaleBefore);
+ }
+
+ public void testMessages() {
+ //ensure the en Locale is set for this test
+ getOrCreateContext().set(TranslationService.LOCALE, "en");
+ TestMessagesObject o = ContextInjectionFactory.make(TestMessagesObject.class, getOrCreateContext());
+
+ //test all values are set
+ assertNotNull(o.Messages);
+ assertNotNull(o.Messages.message);
+ assertNotNull(o.Messages.message_one);
+ assertNotNull(o.Messages.messageOne);
+ assertNotNull(o.Messages.message_two);
+ assertNotNull(o.Messages.messageThree);
+ assertNotNull(o.Messages.messageFour);
+
+ //test the set values
+ assertEquals("Message", o.Messages.message);
+ assertEquals("MessageUnderscore", o.Messages.message_one);
+ assertEquals("MessageCamelCase", o.Messages.messageOne);
+ assertEquals("MessageUnderscoreDot", o.Messages.message_two);
+ assertEquals("MessageCamelCaseDot", o.Messages.messageThree);
+ assertEquals("The idea is from Tom", o.Messages.messageFour);
+ }
+
+ public void testMessagesDifferentLocale() {
+ //set Locale to de
+ getOrCreateContext().set(TranslationService.LOCALE, "de");
+ TestMessagesObject o = ContextInjectionFactory.make(TestMessagesObject.class, getOrCreateContext());
+
+ //test all values are set
+ assertNotNull(o.Messages);
+ assertNotNull(o.Messages.message);
+ assertNotNull(o.Messages.message_one);
+ assertNotNull(o.Messages.messageOne);
+ assertNotNull(o.Messages.message_two);
+ assertNotNull(o.Messages.messageThree);
+ assertNotNull(o.Messages.messageFour);
+
+ //test the set values
+ assertEquals("Nachricht", o.Messages.message);
+ assertEquals("NachrichtUnderscore", o.Messages.message_one);
+ assertEquals("NachrichtCamelCase", o.Messages.messageOne);
+ assertEquals("NachrichtUnderscoreDot", o.Messages.message_two);
+ //for messageThree there is no key specified in de properties file, so there should be the fallback
+ assertEquals("MessageCamelCaseDot", o.Messages.messageThree);
+ assertEquals("Die Idee ist von Tom", o.Messages.messageFour);
+ }
+
+ public void testMessagesSkipDefaultLocaleForEquinoxRoot() {
+ Locale defaultLocaleBefore = Locale.getDefault();
+ //change the default Locale for this testcase
+ Locale.setDefault(new Locale("de"));
+
+ //set the locale to en
+ //as there is no _en properties file, by default the _de properties file would be loaded and we would
+ //get german translations as the default locale is set to "de_DE"
+ //with checking the equinox.root.locale in the system properties the fallback is skipped as it tells
+ //that the root properties file is for locale en.
+ getOrCreateContext().set(TranslationService.LOCALE, "en");
+ TestMessagesObject o = ContextInjectionFactory.make(TestMessagesObject.class, getOrCreateContext());
+
+ //test all values are set
+ assertNotNull(o.Messages);
+ assertNotNull(o.Messages.message);
+ assertNotNull(o.Messages.message_one);
+ assertNotNull(o.Messages.messageOne);
+ assertNotNull(o.Messages.message_two);
+ assertNotNull(o.Messages.messageThree);
+ assertNotNull(o.Messages.messageFour);
+
+ //not the default resource bundle should be used (e.g. de when running on a machine with german OS)
+ //but the default resource bundle
+ assertEquals("Message", o.Messages.message);
+ assertEquals("MessageUnderscore", o.Messages.message_one);
+ assertEquals("MessageCamelCase", o.Messages.messageOne);
+ assertEquals("MessageUnderscoreDot", o.Messages.message_two);
+ assertEquals("MessageCamelCaseDot", o.Messages.messageThree);
+ assertEquals("The idea is from Tom", o.Messages.messageFour);
+
+ //reset the default locale
+ Locale.setDefault(defaultLocaleBefore);
+ }
+
+ public void testMessagesUseDefaultLocaleForInvalidLocale() {
+ Locale defaultLocaleBefore = Locale.getDefault();
+ //change the default Locale for this testcase
+ Locale.setDefault(new Locale("de"));
+
+ //set a locale for which no resource bundle is set
+ getOrCreateContext().set(TranslationService.LOCALE, "fr");
+ TestMessagesObject o = ContextInjectionFactory.make(TestMessagesObject.class, getOrCreateContext());
+
+ //test all values are set
+ assertNotNull(o.Messages);
+ assertNotNull(o.Messages.message);
+ assertNotNull(o.Messages.message_one);
+ assertNotNull(o.Messages.messageOne);
+ assertNotNull(o.Messages.message_two);
+ assertNotNull(o.Messages.messageThree);
+ assertNotNull(o.Messages.messageFour);
+
+ //the default resource bundle should be used
+ assertEquals("Nachricht", o.Messages.message);
+ assertEquals("NachrichtUnderscore", o.Messages.message_one);
+ assertEquals("NachrichtCamelCase", o.Messages.messageOne);
+ assertEquals("NachrichtUnderscoreDot", o.Messages.message_two);
+ //for messageThree there is no key specified in de properties file, so there should be the fallback
+ assertEquals("MessageCamelCaseDot", o.Messages.messageThree);
+ assertEquals("Die Idee ist von Tom", o.Messages.messageFour);
+
+ //reset the default locale
+ Locale.setDefault(defaultLocaleBefore);
+ }
+
+ public void testBundleMessages() {
+ //ensure the en Locale is set for this test
+ getOrCreateContext().set(TranslationService.LOCALE, "en");
+ TestBundleObject o = ContextInjectionFactory.make(TestBundleObject.class, getOrCreateContext());
+
+ //test all values are set
+ assertNotNull(o.bundleMessages);
+ assertNotNull(o.bundleMessages.message);
+ assertNotNull(o.bundleMessages.message_one);
+ assertNotNull(o.bundleMessages.messageOne);
+ assertNotNull(o.bundleMessages.message_two);
+ assertNotNull(o.bundleMessages.messageThree);
+ assertNotNull(o.bundleMessages.messageFour);
+
+ //test the set values
+ assertEquals("BundleMessage", o.bundleMessages.message);
+ assertEquals("BundleMessageUnderscore", o.bundleMessages.message_one);
+ assertEquals("BundleMessageCamelCase", o.bundleMessages.messageOne);
+ assertEquals("BundleMessageUnderscoreDot", o.bundleMessages.message_two);
+ assertEquals("BundleMessageCamelCaseDot", o.bundleMessages.messageThree);
+ assertEquals("The idea is from Tom", o.bundleMessages.messageFour);
}
- public void testBundle() {
+ public void testBundleMessagesDifferentLocale() {
+ //set Locale to de
+ getOrCreateContext().set(TranslationService.LOCALE, "de");
TestBundleObject o = ContextInjectionFactory.make(TestBundleObject.class, getOrCreateContext());
+
+ //test all values are set
assertNotNull(o.bundleMessages);
- assertNotNull(o.bundleMessages.message_1);
- assertEquals("BundleMessages 1", o.bundleMessages.message_1);
+ assertNotNull(o.bundleMessages.message);
+ assertNotNull(o.bundleMessages.message_one);
+ assertNotNull(o.bundleMessages.messageOne);
+ assertNotNull(o.bundleMessages.message_two);
+ assertNotNull(o.bundleMessages.messageThree);
+ assertNotNull(o.bundleMessages.messageFour);
+
+ //test the set values
+ assertEquals("BundleNachricht", o.bundleMessages.message);
+ assertEquals("BundleNachrichtUnderscore", o.bundleMessages.message_one);
+ assertEquals("BundleNachrichtCamelCase", o.bundleMessages.messageOne);
+ assertEquals("BundleNachrichtUnderscoreDot", o.bundleMessages.message_two);
+ //for messageThree there is no key specified in de properties file, so there should be the fallback
+ assertEquals("BundleMessageCamelCaseDot", o.bundleMessages.messageThree);
+ assertEquals("Die Idee ist von Tom", o.bundleMessages.messageFour);
+ }
+
+ public void testBundleMessagesSkipDefaultLocaleForEquinoxRoot() {
+ Locale defaultLocaleBefore = Locale.getDefault();
+ //change the default Locale for this testcase
+ Locale.setDefault(new Locale("de"));
+
+ //set the locale to en
+ //as there is no _en properties file, by default the _de properties file would be loaded and we would
+ //get german translations as the default locale is set to "de_DE"
+ //with checking the equinox.root.locale in the system properties the fallback is skipped as it tells
+ //that the root properties file is for locale en.
+ getOrCreateContext().set(TranslationService.LOCALE, "en");
+ TestBundleObject o = ContextInjectionFactory.make(TestBundleObject.class, getOrCreateContext());
+
+ //test all values are set
+ assertNotNull(o.bundleMessages);
+ assertNotNull(o.bundleMessages.message);
+ assertNotNull(o.bundleMessages.message_one);
+ assertNotNull(o.bundleMessages.messageOne);
+ assertNotNull(o.bundleMessages.message_two);
+ assertNotNull(o.bundleMessages.messageThree);
+ assertNotNull(o.bundleMessages.messageFour);
+
+ //not the default resource bundle should be used (e.g. de when running on a machine with german OS)
+ //but the default resource bundle
+ assertEquals("BundleMessage", o.bundleMessages.message);
+ assertEquals("BundleMessageUnderscore", o.bundleMessages.message_one);
+ assertEquals("BundleMessageCamelCase", o.bundleMessages.messageOne);
+ assertEquals("BundleMessageUnderscoreDot", o.bundleMessages.message_two);
+ assertEquals("BundleMessageCamelCaseDot", o.bundleMessages.messageThree);
+ assertEquals("The idea is from Tom", o.bundleMessages.messageFour);
+
+ //reset the default locale
+ Locale.setDefault(defaultLocaleBefore);
+ }
+
+ public void testBundleMessagesUseDefaultLocaleForInvalidLocale() {
+ Locale defaultLocaleBefore = Locale.getDefault();
+ //change the default Locale for this testcase
+ Locale.setDefault(new Locale("de"));
+
+ //set a locale for which no resource bundle is set
+ getOrCreateContext().set(TranslationService.LOCALE, "fr");
+ TestBundleObject o = ContextInjectionFactory.make(TestBundleObject.class, getOrCreateContext());
+
+ //test all values are set
+ assertNotNull(o.bundleMessages);
+ assertNotNull(o.bundleMessages.message);
+ assertNotNull(o.bundleMessages.message_one);
+ assertNotNull(o.bundleMessages.messageOne);
+ assertNotNull(o.bundleMessages.message_two);
+ assertNotNull(o.bundleMessages.messageThree);
+ assertNotNull(o.bundleMessages.messageFour);
+
+ //the default resource bundle should be used
+ assertEquals("BundleNachricht", o.bundleMessages.message);
+ assertEquals("BundleNachrichtUnderscore", o.bundleMessages.message_one);
+ assertEquals("BundleNachrichtCamelCase", o.bundleMessages.messageOne);
+ assertEquals("BundleNachrichtUnderscoreDot", o.bundleMessages.message_two);
+ //for messageThree there is no key specified in de properties file, so there should be the fallback
+ assertEquals("BundleMessageCamelCaseDot", o.bundleMessages.messageThree);
+ assertEquals("Die Idee ist von Tom", o.bundleMessages.messageFour);
+
+ //reset the default locale
+ Locale.setDefault(defaultLocaleBefore);
+ }
+
+ public void testClassBasedResourceBundle() {
+ //ensure the en Locale is set for this test
+ getOrCreateContext().set(TranslationService.LOCALE, "en");
+ TestResourceBundleClassObject o = ContextInjectionFactory.make(TestResourceBundleClassObject.class, getOrCreateContext());
+
+ //test all values are set
+ assertNotNull(o.bundleClassMessages);
+ assertNotNull(o.bundleClassMessages.message);
+ assertNotNull(o.bundleClassMessages.message_one);
+ assertNotNull(o.bundleClassMessages.messageOne);
+ assertNotNull(o.bundleClassMessages.message_two);
+ assertNotNull(o.bundleClassMessages.messageThree);
+ assertNotNull(o.bundleClassMessages.messageFour);
+
+ //test the set values
+ assertEquals("ResourceBundleClassMessage", o.bundleClassMessages.message);
+ assertEquals("ResourceBundleClassMessageUnderscore", o.bundleClassMessages.message_one);
+ assertEquals("ResourceBundleClassMessageCamelCase", o.bundleClassMessages.messageOne);
+ assertEquals("ResourceBundleClassMessageUnderscoreDot", o.bundleClassMessages.message_two);
+ assertEquals("ResourceBundleClassCamelCaseDot", o.bundleClassMessages.messageThree);
+ assertEquals("The idea is from Tom", o.bundleClassMessages.messageFour);
+ }
+
+ public void testClassBasedResourceBundleDifferentLocale() {
+ //set Locale to de
+ getOrCreateContext().set(TranslationService.LOCALE, "de");
+ TestResourceBundleClassObject o = ContextInjectionFactory.make(TestResourceBundleClassObject.class, getOrCreateContext());
+
+ //test all values are set
+ assertNotNull(o.bundleClassMessages);
+ assertNotNull(o.bundleClassMessages.message);
+ assertNotNull(o.bundleClassMessages.message_one);
+ assertNotNull(o.bundleClassMessages.messageOne);
+ assertNotNull(o.bundleClassMessages.message_two);
+ assertNotNull(o.bundleClassMessages.messageThree);
+ assertNotNull(o.bundleClassMessages.messageFour);
+
+ //test the set values
+ assertEquals("ResourceBundleClassNachricht", o.bundleClassMessages.message);
+ assertEquals("ResourceBundleClassNachrichtUnderscore", o.bundleClassMessages.message_one);
+ assertEquals("ResourceBundleClassNachrichtCamelCase", o.bundleClassMessages.messageOne);
+ assertEquals("ResourceBundleNachrichtMessageUnderscoreDot", o.bundleClassMessages.message_two);
+ //for messageThree there is no key specified in de properties file, so there should be the fallback
+ assertEquals("ResourceBundleClassCamelCaseDot", o.bundleClassMessages.messageThree);
+ assertEquals("Die Idee ist von Tom", o.bundleClassMessages.messageFour);
}
- public void testResourceBundle() {
+ public void testClassBasedResourceBundleSkipDefaultLocaleForEquinoxRoot() {
+ Locale defaultLocaleBefore = Locale.getDefault();
+ //change the default Locale for this testcase
+ Locale.setDefault(new Locale("de"));
+
+ //set the locale to en
+ //as there is no _en properties file, by default the _de properties file would be loaded and we would
+ //get german translations as the default locale is set to "de_DE"
+ //with checking the equinox.root.locale in the system properties the fallback is skipped as it tells
+ //that the root properties file is for locale en.
+ getOrCreateContext().set(TranslationService.LOCALE, "en");
+ TestResourceBundleClassObject o = ContextInjectionFactory.make(TestResourceBundleClassObject.class, getOrCreateContext());
+
+ //test all values are set
+ assertNotNull(o.bundleClassMessages);
+ assertNotNull(o.bundleClassMessages.message);
+ assertNotNull(o.bundleClassMessages.message_one);
+ assertNotNull(o.bundleClassMessages.messageOne);
+ assertNotNull(o.bundleClassMessages.message_two);
+ assertNotNull(o.bundleClassMessages.messageThree);
+ assertNotNull(o.bundleClassMessages.messageFour);
+
+ //not the default resource bundle should be used (e.g. de when running on a machine with german OS)
+ //but the default resource bundle
+ assertEquals("ResourceBundleClassMessage", o.bundleClassMessages.message);
+ assertEquals("ResourceBundleClassMessageUnderscore", o.bundleClassMessages.message_one);
+ assertEquals("ResourceBundleClassMessageCamelCase", o.bundleClassMessages.messageOne);
+ assertEquals("ResourceBundleClassMessageUnderscoreDot", o.bundleClassMessages.message_two);
+ assertEquals("ResourceBundleClassCamelCaseDot", o.bundleClassMessages.messageThree);
+ assertEquals("The idea is from Tom", o.bundleClassMessages.messageFour);
+
+ //reset the default locale
+ Locale.setDefault(defaultLocaleBefore);
+ }
+
+ public void testClassBasedResourceBundleUseDefaultLocaleForInvalidLocale() {
+ Locale defaultLocaleBefore = Locale.getDefault();
+ //change the default Locale for this testcase
+ Locale.setDefault(new Locale("de"));
+
+ //set a locale for which no resource bundle is set
+ getOrCreateContext().set(TranslationService.LOCALE, "fr");
TestResourceBundleClassObject o = ContextInjectionFactory.make(TestResourceBundleClassObject.class, getOrCreateContext());
+
+ //test all values are set
assertNotNull(o.bundleClassMessages);
- assertNotNull(o.bundleClassMessages.message_1);
- assertEquals("ResourceBundleClass 1", o.bundleClassMessages.message_1);
+ assertNotNull(o.bundleClassMessages.message);
+ assertNotNull(o.bundleClassMessages.message_one);
+ assertNotNull(o.bundleClassMessages.messageOne);
+ assertNotNull(o.bundleClassMessages.message_two);
+ assertNotNull(o.bundleClassMessages.messageThree);
+ assertNotNull(o.bundleClassMessages.messageFour);
+
+ //the default resource bundle should be used
+ assertEquals("ResourceBundleClassNachricht", o.bundleClassMessages.message);
+ assertEquals("ResourceBundleClassNachrichtUnderscore", o.bundleClassMessages.message_one);
+ assertEquals("ResourceBundleClassNachrichtCamelCase", o.bundleClassMessages.messageOne);
+ assertEquals("ResourceBundleNachrichtMessageUnderscoreDot", o.bundleClassMessages.message_two);
+ //for messageThree there is no key specified in de properties file, so there should be the fallback
+ assertEquals("ResourceBundleClassCamelCaseDot", o.bundleClassMessages.messageThree);
+ assertEquals("Die Idee ist von Tom", o.bundleClassMessages.messageFour);
+
+ //reset the default locale
+ Locale.setDefault(defaultLocaleBefore);
+ }
+
+// //TODO test location (within plugin)
+
+ public void testResourcesBundle() {
+ //ensure the en Locale is set for this test
+ getOrCreateContext().set(TranslationService.LOCALE, "en");
+ TestResourcesBundleObject o = ContextInjectionFactory.make(TestResourcesBundleObject.class, getOrCreateContext());
+
+ //test all values are set
+ assertNotNull(o.resourcesMessages);
+ assertNotNull(o.resourcesMessages.message);
+ assertNotNull(o.resourcesMessages.message_one);
+ assertNotNull(o.resourcesMessages.messageOne);
+ assertNotNull(o.resourcesMessages.message_two);
+ assertNotNull(o.resourcesMessages.messageThree);
+ assertNotNull(o.resourcesMessages.messageFour);
+
+ //test the set values
+ assertEquals("ResourcesMessage", o.resourcesMessages.message);
+ assertEquals("ResourcesMessageUnderscore", o.resourcesMessages.message_one);
+ assertEquals("ResourcesMessageCamelCase", o.resourcesMessages.messageOne);
+ assertEquals("ResourcesMessageUnderscoreDot", o.resourcesMessages.message_two);
+ assertEquals("ResourcesMessageCamelCaseDot", o.resourcesMessages.messageThree);
+ assertEquals("The idea is from Tom", o.resourcesMessages.messageFour);
}
+
+ public void testResourcesBundleDifferentLocale() {
+ //set Locale to de
+ getOrCreateContext().set(TranslationService.LOCALE, "de");
+ TestResourcesBundleObject o = ContextInjectionFactory.make(TestResourcesBundleObject.class, getOrCreateContext());
+
+ //test all values are set
+ assertNotNull(o.resourcesMessages);
+ assertNotNull(o.resourcesMessages.message);
+ assertNotNull(o.resourcesMessages.message_one);
+ assertNotNull(o.resourcesMessages.messageOne);
+ assertNotNull(o.resourcesMessages.message_two);
+ assertNotNull(o.resourcesMessages.messageThree);
+ assertNotNull(o.resourcesMessages.messageFour);
+
+ //test the set values
+ assertEquals("ResourceNachricht", o.resourcesMessages.message);
+ assertEquals("ResourceNachrichtUnderscore", o.resourcesMessages.message_one);
+ assertEquals("ResourceNachrichtCamelCase", o.resourcesMessages.messageOne);
+ assertEquals("ResourceNachrichtUnderscoreDot", o.resourcesMessages.message_two);
+ //for messageThree there is no key specified in de properties file, so there should be the fallback
+ assertEquals("ResourcesMessageCamelCaseDot", o.resourcesMessages.messageThree);
+ assertEquals("Die Idee ist von Tom", o.resourcesMessages.messageFour);
+ }
+
+ public void testResourcesBundleSkipDefaultLocaleForEquinoxRoot() {
+ Locale defaultLocaleBefore = Locale.getDefault();
+ //change the default Locale for this testcase
+ Locale.setDefault(new Locale("de"));
+
+ //set the locale to en
+ //as there is no _en properties file, by default the _de properties file would be loaded and we would
+ //get german translations as the default locale is set to "de_DE"
+ //with checking the equinox.root.locale in the system properties the fallback is skipped as it tells
+ //that the root properties file is for locale en.
+ getOrCreateContext().set(TranslationService.LOCALE, "en");
+ TestResourcesBundleObject o = ContextInjectionFactory.make(TestResourcesBundleObject.class, getOrCreateContext());
+
+ //test all values are set
+ assertNotNull(o.resourcesMessages);
+ assertNotNull(o.resourcesMessages.message);
+ assertNotNull(o.resourcesMessages.message_one);
+ assertNotNull(o.resourcesMessages.messageOne);
+ assertNotNull(o.resourcesMessages.message_two);
+ assertNotNull(o.resourcesMessages.messageThree);
+ assertNotNull(o.resourcesMessages.messageFour);
+
+ //not the default resource bundle should be used (e.g. de when running on a machine with german OS)
+ //but the default resource bundle
+ assertEquals("ResourcesMessage", o.resourcesMessages.message);
+ assertEquals("ResourcesMessageUnderscore", o.resourcesMessages.message_one);
+ assertEquals("ResourcesMessageCamelCase", o.resourcesMessages.messageOne);
+ assertEquals("ResourcesMessageUnderscoreDot", o.resourcesMessages.message_two);
+ assertEquals("ResourcesMessageCamelCaseDot", o.resourcesMessages.messageThree);
+ assertEquals("The idea is from Tom", o.resourcesMessages.messageFour);
+
+ //reset the default locale
+ Locale.setDefault(defaultLocaleBefore);
+ }
+
+ public void testResourcesBundleUseDefaultLocaleForInvalidLocale() {
+ Locale defaultLocaleBefore = Locale.getDefault();
+ //change the default Locale for this testcase
+ Locale.setDefault(new Locale("de"));
+
+ //set a locale for which no resource bundle is set
+ getOrCreateContext().set(TranslationService.LOCALE, "fr");
+ TestResourcesBundleObject o = ContextInjectionFactory.make(TestResourcesBundleObject.class, getOrCreateContext());
+
+ //test all values are set
+ assertNotNull(o.resourcesMessages);
+ assertNotNull(o.resourcesMessages.message);
+ assertNotNull(o.resourcesMessages.message_one);
+ assertNotNull(o.resourcesMessages.messageOne);
+ assertNotNull(o.resourcesMessages.message_two);
+ assertNotNull(o.resourcesMessages.messageThree);
+ assertNotNull(o.resourcesMessages.messageFour);
+
+ //the default resource bundle should be used
+ assertEquals("ResourceNachricht", o.resourcesMessages.message);
+ assertEquals("ResourceNachrichtUnderscore", o.resourcesMessages.message_one);
+ assertEquals("ResourceNachrichtCamelCase", o.resourcesMessages.messageOne);
+ assertEquals("ResourceNachrichtUnderscoreDot", o.resourcesMessages.message_two);
+ //for messageThree there is no key specified in de properties file, so there should be the fallback
+ assertEquals("ResourcesMessageCamelCaseDot", o.resourcesMessages.messageThree);
+ assertEquals("Die Idee ist von Tom", o.resourcesMessages.messageFour);
+
+ //reset the default locale
+ Locale.setDefault(defaultLocaleBefore);
+ }
+
} \ No newline at end of file
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/ResourceBundleClass.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/ResourceBundleClass.java
index 8c90ea3..643ee24 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/ResourceBundleClass.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/ResourceBundleClass.java
@@ -6,7 +6,12 @@ public class ResourceBundleClass extends ListResourceBundle {
@Override
protected Object[][] getContents() {
return new Object[][] {
- new Object[] { "message_1", "ResourceBundleClass 1" }
+ new Object[] { "message", "ResourceBundleClassMessage" },
+ new Object[] { "message_one", "ResourceBundleClassMessageUnderscore" },
+ new Object[] { "messageOne", "ResourceBundleClassMessageCamelCase" },
+ new Object[] { "message_two", "ResourceBundleClassMessageUnderscoreDot" },
+ new Object[] { "messageThree", "ResourceBundleClassCamelCaseDot" },
+ new Object[] { "messageFour", "The idea is from {0}" }
};
}
} \ No newline at end of file
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/ResourceBundleClassMessages.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/ResourceBundleClassMessages.java
index a7fc609..40a437b 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/ResourceBundleClassMessages.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/ResourceBundleClassMessages.java
@@ -1,8 +1,37 @@
package org.eclipse.e4.core.internal.tests.nls;
+import java.text.MessageFormat;
+
+import javax.annotation.PostConstruct;
+
import org.eclipse.e4.core.services.nls.Message;
+/**
+ * Load messages out of a class based resource bundle specified in the annotation.
+ */
@Message(contributorURI="bundleclass://org.eclipse.e4.core.tests/org.eclipse.e4.core.internal.tests.nls.ResourceBundleClass")
public class ResourceBundleClassMessages {
- public String message_1;
+
+ //message as is
+ public String message;
+
+ //message as is with underscore
+ public String message_one;
+
+ //message as is camel cased
+ public String messageOne;
+
+ //message with underscore transformed to . separated properties key
+ public String message_two;
+
+ //camel cased message transformed to . separated properties key
+ public String messageThree;
+
+ //message with placeholder
+ public String messageFour;
+
+ @PostConstruct
+ public void format() {
+ messageFour = MessageFormat.format(messageFour, "Tom"); //$NON-NLS-1$
+ }
}
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/ResourceBundleClass_de.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/ResourceBundleClass_de.java
new file mode 100644
index 0000000..3389416
--- /dev/null
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/ResourceBundleClass_de.java
@@ -0,0 +1,16 @@
+package org.eclipse.e4.core.internal.tests.nls;
+
+import java.util.ListResourceBundle;
+
+public class ResourceBundleClass_de extends ListResourceBundle {
+ @Override
+ protected Object[][] getContents() {
+ return new Object[][] {
+ new Object[] { "message", "ResourceBundleClassNachricht" },
+ new Object[] { "message_one", "ResourceBundleClassNachrichtUnderscore" },
+ new Object[] { "messageOne", "ResourceBundleClassNachrichtCamelCase" },
+ new Object[] { "message_two", "ResourceBundleNachrichtMessageUnderscoreDot" },
+ new Object[] { "messageFour", "Die Idee ist von {0}" }
+ };
+ }
+} \ No newline at end of file
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/ResourcesMessages.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/ResourcesMessages.java
new file mode 100644
index 0000000..30a6055
--- /dev/null
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/ResourcesMessages.java
@@ -0,0 +1,37 @@
+package org.eclipse.e4.core.internal.tests.nls;
+
+import java.text.MessageFormat;
+
+import javax.annotation.PostConstruct;
+
+import org.eclipse.e4.core.services.nls.Message;
+
+/**
+ * Load messages from a resource folder in the plugin
+ */
+@Message(contributorURI="platform:/plugin/org.eclipse.e4.core.tests/resources/another")
+public class ResourcesMessages {
+
+ //message as is
+ public String message;
+
+ //message as is with underscore
+ public String message_one;
+
+ //message as is camel cased
+ public String messageOne;
+
+ //message with underscore transformed to . separated properties key
+ public String message_two;
+
+ //camel cased message transformed to . separated properties key
+ public String messageThree;
+
+ //message with placeholder
+ public String messageFour;
+
+ @PostConstruct
+ public void format() {
+ messageFour = MessageFormat.format(messageFour, "Tom"); //$NON-NLS-1$
+ }
+}
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/SimpleMessages.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/SimpleMessages.java
index 72d6d7e..316bda1 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/SimpleMessages.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/SimpleMessages.java
@@ -1,5 +1,34 @@
package org.eclipse.e4.core.internal.tests.nls;
+import java.text.MessageFormat;
+
+import javax.annotation.PostConstruct;
+
+/**
+ * Load messages from a relative positioned resource bundle (./SimpleMessages.properties)
+ */
public class SimpleMessages {
- public String message_1;
+
+ //message as is
+ public String message;
+
+ //message as is with underscore
+ public String message_one;
+
+ //message as is camel cased
+ public String messageOne;
+
+ //message with underscore transformed to . separated properties key
+ public String message_two;
+
+ //camel cased message transformed to . separated properties key
+ public String messageThree;
+
+ //message with placeholder
+ public String messageFour;
+
+ @PostConstruct
+ public void format() {
+ messageFour = MessageFormat.format(messageFour, "Tom"); //$NON-NLS-1$
+ }
}
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/SimpleMessages.properties b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/SimpleMessages.properties
index d406c07..9426108 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/SimpleMessages.properties
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/SimpleMessages.properties
@@ -1 +1,6 @@
-message_1=SimpleMessages 1 \ No newline at end of file
+message=SimpleMessage
+message_one=SimpleMessageUnderscore
+messageOne=SimpleMessageCamelCase
+message.two=SimpleMessageUnderscoreDot
+message.three=SimpleMessageCamelCaseDot
+message.four=The idea is from {0} \ No newline at end of file
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/SimpleMessages_de.properties b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/SimpleMessages_de.properties
new file mode 100644
index 0000000..f7c69cf
--- /dev/null
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/SimpleMessages_de.properties
@@ -0,0 +1,5 @@
+message=SimpleNachricht
+message_one=SimpleNachrichtUnderscore
+messageOne=SimpleNachrichtCamelCase
+message.two=SimpleNachrichtUnderscoreDot
+message.four=Die Idee ist von {0} \ No newline at end of file
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/messages.properties b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/messages.properties
new file mode 100644
index 0000000..b59b0fb
--- /dev/null
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/messages.properties
@@ -0,0 +1,6 @@
+message=Message
+message_one=MessageUnderscore
+messageOne=MessageCamelCase
+message.two=MessageUnderscoreDot
+message.three=MessageCamelCaseDot
+message.four=The idea is from {0} \ No newline at end of file
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/messages_de.properties b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/messages_de.properties
new file mode 100644
index 0000000..b58880e
--- /dev/null
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/nls/messages_de.properties
@@ -0,0 +1,5 @@
+message=Nachricht
+message_one=NachrichtUnderscore
+messageOne=NachrichtCamelCase
+message.two=NachrichtUnderscoreDot
+message.four=Die Idee ist von {0} \ No newline at end of file