use of com.enonic.xp.i18n.MessageBundle in project xp by enonic.
the class LocaleServiceImplTest method get_bundle_multi.
@Test
public void get_bundle_multi() {
final MessageBundle bundle = localeService.getBundle(ApplicationKey.from("myapplication"), Locale.ENGLISH, "/phrases", "/override");
assertNotNull(bundle);
assertEquals(9, bundle.getKeys().size());
assertEquals("override", bundle.localize("msg"));
}
use of com.enonic.xp.i18n.MessageBundle in project xp by enonic.
the class LocaleServiceImplTest method get_UTF8_chars.
@Test
public void get_UTF8_chars() {
final MessageBundle bundle = localeService.getBundle(ApplicationKey.from("myapplication"), Locale.ENGLISH);
assertNotNull(bundle);
assertEquals("æøå", bundle.localize("norwegian"));
assertEquals("ÄäÜüß", bundle.localize("german"));
assertEquals("ŁĄŻĘĆŃŚŹ", bundle.localize("polish"));
assertEquals("ЯБГДЖЙ", bundle.localize("russian"));
assertEquals("アイウエオカキクケコサシスセソタチツテ", bundle.localize("japanese"));
}
use of com.enonic.xp.i18n.MessageBundle in project xp by enonic.
the class LocaleServiceImplTest method get_bundle_norwegian_nn.
@Test
public void get_bundle_norwegian_nn() {
final MessageBundle bundle = localeService.getBundle(ApplicationKey.from("myapplication"), Locale.forLanguageTag("nn"), "norwegian");
assertThat(bundle.asMap()).containsExactlyInAnyOrderEntriesOf(Map.of("a", "default", "c", "nn", "d", "no"));
}
use of com.enonic.xp.i18n.MessageBundle in project xp by enonic.
the class MessageBundleImplTest method nullArguments.
@Test
public void nullArguments() {
final Properties properties = new Properties();
properties.put("key1", "{0}");
MessageBundle resourceBundle = new MessageBundleImpl(properties, Locale.ROOT);
assertEquals("{0}", resourceBundle.localize("key1", (Object[]) null));
}
use of com.enonic.xp.i18n.MessageBundle in project xp by enonic.
the class MessageBundleImplTest method nullArgument.
@Test
public void nullArgument() {
final Properties properties = new Properties();
properties.put("key1", "{0}");
MessageBundle resourceBundle = new MessageBundleImpl(properties, Locale.ROOT);
assertEquals("null", resourceBundle.localize("key1", (Object) null));
}
Aggregations