Skip to content
zepheiryan edited this page Jan 25, 2012 · 3 revisions

The localization system in Exhibit 3.0 uses a key-based lookup to better separate content from control. All of the scripts (except the debugging tools) use the localization system to be able to display all of Exhibit according to the desired locale of the author. This document covers two separate topics, how to add a new locale, and how to use the localization system as a developer. First, adding a locale.

Adding a locale

We will most likely ask for locale contributions close to a release when the keys and values are generally frozen so you won't have to keep making changes and updates to keep up with our changes and updates. However, we're glad to take a translation at any time.

To add a locale, look in scripted/src/locales/ and create a directory matching the locale. While all of the current locales use the two-letter scheme, more specific locales are welcome (or necessary, if you were to contribute Portuguese, for instance).

Copy over scripted/src/locales/en/locale.js to your new directory and start translating.

Consider any key named with ".error." in it optional. They are debugging messages mostly useful to developers looking for problems, and the UI will never display them to those browsing an Exhibit. You can leave any key either out of the translation or with an explicit value of undefined to indicate you don't have a translation for it. The latter is preferred so others will know which keys still need translating.

Add it to scripted/src/locales/manifest.js:

// For example,
// new Exhibit.Locale("locale-identifier", Exhibit.urlPrefix + "locales/locale-identifier/locale.js");

// For pt-BR
new Exhibit.Locale("pt-BR", Exhibit.urlPrefix + "locales/pt-BR/locale.js");

And send us a pull request.

We do not currently have any RTL languages; if you intend to contribute one, please let us know how the interface holds up with the change in directionality.

Using the system

in progress

The localization system uses sprintf heavily to allow argument reordering depending on the language. See the usage manual for writing sprintf friendly strings.

Some legacy keys currently correlate to non-String values. Do not introduce new instances, these should be replaced or backed out except for very special cases.

Clone this wiki locally