Languages and Translations¶
OnDemand Loop uses Rails' internationalization (I18n) framework to manage text in the user interface. Translation files live under application/config/locales and are organized by component (for example, views, controllers, and shared). Connector-specific translations are grouped under application/config/locales/connectors/<connector> so each connector keeps its own locale files. Only English translations (en.yml) are provided by default.
Translation files¶
Each directory contains a file per language. The English translations are stored in files ending with en.yml. Connector folders can also contain nested subdirectories such as controllers when a connector needs more granular organization. When adding another language, replicate the directory structure and provide a corresponding <locale>.yml file with translated strings.
Adding a new language¶
- Create locale files – Copy the existing English files and rename them with the new locale code. For example, to add French, create
application/config/locales/views/fr.ymland equivalents forcontrollers,shared, and any connectors you need. - Register the locale – Edit
application/config/initializers/locale.rband add the new code toI18n.available_locales. - Set the default (optional) – To make the new language the default, update
Configuration.localeor set theOOD_LOOP_LOCALEenvironment variable. - Provide translations – Replace the English strings in each new file with translations.
- Rebuild the guide – Run
make guideto regenerate documentation if you added docs for the new language.
Once these steps are complete, the new language can be selected by users via the ?locale= parameter or through any configured language selector in the interface.