Languages and interface strings

Pages and interface strings are translated. The installer adds English, Russian and Ukrainian; Russian is the default.

Languages

The default language has no prefix in addresses; another language has its abbreviation as the first part of the path: /ua/about/. The Ukrainian language is ua in addresses and uk in the pages' lang attribute.

«Редактор языков» (Language editor) — /admin/translations/languages/ and the button «Языки» (Languages) on the admin toolbar — adds, edits, orders and deletes languages:

  • a new language needs «Аббревиатура языка» (two lowercase Latin letters), «Название языка» (Language name) and «Открыт посетителям» (Open to visitors);
  • the edit form also sets «Язык по умолчанию» (Default language) and the locale;
  • the current and the default language can't be deleted.

A new language starts as a copy of the default one: every page name, text, interface string and mail template is copied from it, ready to be translated.

A language in preparation. Untick «Открыт посетителям»: visitors get 404 for its addresses and do not see it in the language switcher, while editors — users whose group has full rights on the home page — see it marked «(в подготовке)» (in preparation). The default language can't be closed.

The language switcher is part of the «Базовый» (Basic) layout and shows when more than one language is open.

Translating pages

A page's name, title, description, keywords and «Отключен» (Disabled) are set per language on the language tabs of the page form; a page disabled in a language answers 404 in it. Texts are translated on the page itself: switch the site to the language and edit in «Режим редактирования» (Edit mode). Clearing a text in one language leaves the others as they are.

Interface strings

Every caption of the site and the admin is an interface string: a constant such as TXT_SITE_NAME with a translation for each language. A string without a translation shows its constant name.

  • «Редактор переводов» (Translations editor) — /admin/translations/ and the button «Переводы» (Translations) on the admin toolbar — edits them per language.
  • The site's own strings are in site/modules/main/translations.php: 'CONST' => ['ru' => '…', 'ua' => '…']. php index.php setup translations adds the missing ones to the database and never overwrites a translation edited in the admin; --file=PATH reads another file.
  • php index.php setup untranslated lists the strings used in the code and the templates that have no translation; setup check reports them as a failure.

The ? help of an admin window is the string HELP_<CLASS>_<STATE>, so it is translated and edited like any other.