loading table of contents...

5.7. Localization

Text properties in CoreMedia Studio can be localized. English and German are supported out of the box; you can add your own localization bundles if required. To do so, proceed as follows:

  1. Add the new locale to the studio.locales property in your Studio application's application.properties file.

    This property contains a comma-separated list of locales. The first element in the list is en and specifies the locale of values in the default properties files (that is, the files without a locale suffix). Therefore, you must not change this first entry; it must always remain en (see below).

  2. Add properties files that follow the naming scheme for your added locale, as explained below.

Localized texts are stored in property files according to the Java property file syntax. The naming scheme of these files is:

<FileName>_<IsoLanguageCode>.properties

A property file with no language code contains properties in the default language English. Note that English is only a technical default. The default locale used for users opening CoreMedia Studio for the first time is determined by the best match between their browser language settings and all supported locales.

[Warning]Warning

When one or several properties are missing in locale-specific properties files, their values are inherited from the default language (that is, they will appear in English rather than in the locale the user has set). However, there must be a .properties file for every supported locale as per the studio.locales property in the application.properties. The locale-specific properties file may be empty, but a missing file will result in an error on Studio startup.

Property files are placed beside ActionScript and EXML files in the proper package below the src/main/joo directory. They are compiled into ActionScript classes with the base file name (without the ISO language code), followed by _properties.

Each such class contains a static field INSTANCE which at runtime references an object declaring one attribute for each property declared in the *.properties file, using the property key as the attribute name and the localized value depending on the selected locale. For each property key that is a valid ActionScript identifier, the generated class also declares a getter function to simplify typed access.

If you want to change predefined labels, tooltips or similar, you can override properties from existing properties classes. To this end, you should first define a new property class and then call the static method ResourceBundle#overrideProperties(destination, source) to overwrite an existing property class with the values stored in your new property class. This method will never remove a property key, it will only update existing values.

Note that the call to ResourceBundle.overrideProperties references the ActionScript classes, not the property maps reachable through the static INSTANCE fields.

Generally, each Studio plugin module will contain at least one set of property files for localizing its own components or for adapting existing property files.