use of com.enonic.xp.i18n.MessageBundle in project xp by enonic.
the class MessageBundleImplTest method testEmptyResourceBundle.
@Test
public void testEmptyResourceBundle() {
MessageBundle resourceBundle = new MessageBundleImpl(new Properties(), Locale.ENGLISH);
assertNull(resourceBundle.localize("dummyKey"));
}
use of com.enonic.xp.i18n.MessageBundle in project xp by enonic.
the class MessageBundleImplTest method alwaysUTC.
@Test
public void alwaysUTC() {
final Properties properties = new Properties();
properties.put("key1", "{0,date,z}");
MessageBundle resourceBundle = new MessageBundleImpl(properties, Locale.ROOT);
assertEquals("UTC", resourceBundle.localize("key1", System.currentTimeMillis()));
}
use of com.enonic.xp.i18n.MessageBundle in project xp by enonic.
the class MessageBundleImplTest method testParameterizedPhrase_two_values.
@Test
public void testParameterizedPhrase_two_values() {
MessageBundle resourceBundle = createDefault();
Object[] testArgs = { "myValue1", "myValue2" };
String resolvedPhrase = resourceBundle.localize("key5", testArgs);
assertEquals("value is here myValue1 and there myValue2", resolvedPhrase);
}
use of com.enonic.xp.i18n.MessageBundle in project xp by enonic.
the class MessageBundleImplTest method testAsMap.
@Test
public void testAsMap() {
final MessageBundle resourceBundle = createDefault();
final Map<String, String> map = resourceBundle.asMap();
assertEquals(6, map.size());
}
use of com.enonic.xp.i18n.MessageBundle in project xp by enonic.
the class MessageBundleImplTest method dateTime.
@Test
public void dateTime() {
final Properties properties = new Properties();
properties.put("key1", "{0,time,short} {0,date,short}");
MessageBundle resourceBundle = new MessageBundleImpl(properties, Locale.TRADITIONAL_CHINESE);
assertEquals("上午9:46 1973/3/3", resourceBundle.localize("key1", Instant.ofEpochMilli(100000000000L).toEpochMilli()));
}
Aggregations