Localization

Extensions

In multilingual projects, it may be necessary to translate text visible to the user, such as button labels or messages displayed for a specific action. To do this, all phrases in plugin templates should be specified using the following construction:

<?= $this->lang('Phrase requiring translation'); ?>

These phrases will be available for translation in the plugin settings under the "Localization" section. The translation files are stored in the following path: /plugins/plugin_name/lang/{xx}.php, and have the following structure:

<?php

return array (
  'Original phrase1' => 'Translation1',
  'Original phrase2' => 'Translation2',
);

When saving the translation in the settings, the translation files are saved in the directory /files/extensions/plugin_name/lang/{xx}.php. The macro {xx} represents the two-letter language code, which can be found in the file /bff/languages.php.

Localization of phrases used in the admin panel interface is done using the similar function langAdmin.

The localization of extension instructions is available through the files readme-{xx}.md.