Skip to Content
GuidesTranslations

Setting Up Translations

⚠️

Creating custom translations is only available manually through files.

Flute CMS supports translations into any languages.

Creating Custom Translations

All translations are located in the i18n folder, inside which language directories are placed.

To create your own translation (for example, for use in navigation), follow these steps:

  1. Go to the i18n folder in the project root.
  2. Open the folder with the desired language (for example, en).
  3. Create a new PHP file with an arbitrary name, for example my_translation.php.
  4. Add translations in PHP array format.

Example structure and file /i18n/en/my_translation.php:

      • my_translation.php
      • def.php
      • admin.php
      • auth.php
      • ...
// /i18n/en/my_translation.php return [ 'my_key' => 'My translation', ];

Using Translations

To use the created translation, use the syntax filename.key. In the example above, this would be:

my_translation.my_key

You can use translations in the following places:

  1. Menu items
  2. Social network names
  3. Site footer elements
  4. Page titles
  5. And any other interface elements

Translation usage example

If there is no translation for the current language, the first found translation will be used (English by default).
If English is disabled, the key will be displayed instead of text.

Integrating Your Own Language

To integrate your own language that is not in Flute CMS, follow these steps:

Modify the config/lang.php file and add your language to the available and all arrays.

<?php return array ( 'locale' => 'en', 'cache' => false, 'available' => array ( 0 => 'en', 1 => 'ru', 2 => 'pl', 3 => 'uk', 4 => 'de', 5 => 'zh', 6 => 'fr', 7 => 'es', 8 => 'uz', 9 => 'pt', 10 => 'br', // In our case this will be Italian 11 => 'it', ), 'all' => array ( 0 => 'en', 1 => 'ru', 2 => 'pl', 3 => 'uk', 4 => 'de', 5 => 'zh', 6 => 'fr', 7 => 'es', 8 => 'uz', 9 => 'pt', 10 => 'br', // Our language 11 => 'it', ), );

After entering the language, create a folder with the language name in the i18n folder and gradually add all translation files to it.

Example final structure in the i18n folder:

      • def.php
      • admin.php
      • auth.php
      • ...