Internationalization

For simplicity, the examples provided so far in this guide have translatable text embedded in the code directly. Although MotiveWave™ does not currently support multiple languages (at least as of writing this guide), it is inevitable that this will happen at some point in the near future.

All of the studies available in MotiveWave™ have the translatable text separated into a Resource Bundle. Resource Bundles are a standard mechanism built into Java for internationalization. If you are unfamiliar with this construct, there are many tutorials available on the internet. Here is a general tutorial available on the Oracle™ website: http://docs.oracle.com/javase/tutorial/i18n/resbundle/concept.html

Separating text in a study is very simple and only requires you to do the following:

  1. Declare the Resource Bundle – In the Study Header, specify the package and name of the resource bundle using the rb property

  2. Use the get(“LABEL_ID”, …) to retrieve text. This method available from the Study class pulls text from the resource bundle associated with the given ID. Values in the text can be replaced by specifying these values after the label ID (named %1, %2, %3…)

Example: MACD

The following example shows the Study Header for the MACD study. In this case the rb property is pointing to the resource bundle: com.motivewave.platform.study.nls.strings. This will resolve to the strings.properties file (for English translation) in the com/motivewave/platform/study/nls directory.

Once the rb property is defined in the Study Header, MotiveWave™ will assume that the other properties (that expect displayable text) are actually IDs that need to be resolved from the resource bundle.

Last updated