Skip to main content

Nebula CDateTime Widget(Internationalization)

The CDateTime makes full use of Java's Locale object throughout. Upon creation, The locale is set to set the system's default, but can be changed at runtime via the setLocale method.

Although most translations are provided through the java.util.SimpleDateFormat object, there a few cases where CDateTime must rely upon external property files in order to be translated correctly. Because this is a widget and not a full application, it is quite possible that multiple instances may created with different locales. For this reason, the Messages class does not hold a static reference to a given properties file, but can map to multiple files as they are activated.

https://raw.githubusercontent.com/eclipse/nebula/master/examples/org.eclipse.nebula.snippets/src/org/eclipse/nebula/snippets/visualization/SimpleExample.java Presently a few translations are available
If you can help by creating a translation (a very simple one!), simply file a Feature Request for [I18N] and attach your translated version of the properties file.
View the properties file: English (US),

Textual

When the pattern is set with CDateTime's setFormat method, the locale is fully utilized to specify the appropriate fields, their order and style (ie 12 or 24 hour format). However, when the pattern is set explicitly with CDateTime's setPattern method, the individual text fields will be translated appropriately, but their order and style will follow the programmatical setting.
There is one exception though - the 'null string' cannot be translated via java.util.SimpleDateFormat, and the properties file is referenced in this particular case.

Graphical

The most noteable difference from a locale specified format using setFormat and a custom one with setPattern is changing the style of the Time Selector (aka Clock). By using a 12 or 24 hour pattern, the locale will be overridden when creating the clock dial. A similar affect can be achieved with the style settings by forcing one clock style over another with either CLOCK_12_HOUR or CLOCK_24_HOUR.
The properties file is referenced for navigational items, such as "Next Month" and "Go to Today".


Back to the top