Skip to main content

Locale System

Switching the screen's language and adding a translation.

This section

Locale System

Every word the screen says — menu labels, page titles, loading stages, the music player — comes from a locale file.

Built-In Locales​

FileLanguage
locales/en.luaEnglish
locales/tr.luaTurkish

Choosing the Language​

lua
Config.lang = 'en'

Config.lang also tells the screen how to write capitals — the Turkish i becomes İ under 'tr' and I under 'en'.

Locale File Format​

lua
Locales = Locales or {}

Locales['en'] = {
['menu.label'] = 'Menu',
['progress.map'] = 'Loading the map',
['gallery.count'] = '%s photos',
-- …
}

%s is filled in by the screen (a count, a name) — keep it where it belongs.

Adding a Language​

  1. Copy locales/en.lua to locales/de.lua
  2. Change Locales['en'] at the top to Locales['de']
  3. Translate the values on the right, keep the keys on the left unchanged
  4. Set Config.lang = 'de'

A new locale file is picked up automatically, and it stays editable after escrow.