Studio › Manual › Studio kit

tr() and languages in the game

draw_text(x, y, tr("menu_play"));
draw_text(x, y, tr("coins", coins));          // "{0} {0:coin|coins}"
loc_set_language("es");
if (loc_is_rtl()) draw_set_halign(fa_right);
  • tr(key, ...) gives the text in the current language (the default language's when it has none, else the key). {0}, {1} … are the arguments; {0:one|other} picks the plural form by the number, with each language's rules (French and Portuguese, the Slavic languages' three forms, Arabic's six, one form for Japanese, Chinese and Korean).
  • The game starts in the system's language when it has it (pt-BR, then pt), else the default. loc_set_language(code), loc_get_language(), loc_languages(), loc_language_name(code).
  • UI controls (of every kind, with list, dropdown and tab items and text box placeholders) whose text is a key show its translation and change at once when the language does; in right-to-left languages their left and right alignment swap.
  • Run in a language: the Run Target menu's Language section, or Next Run Language (⌃⇧⌘6), starts runs from Studio in that language (the project isn't changed).

Keys are shown as on the Mac: ⌘ Command, ⌥ Option, ⌃ Control, ⇧ Shift. Studio for Windows shows its own keys beside each menu item.