Revision: Thu, 26 Sep 2024 15:47:52 GMT
v2.14 – outdated
This version of the documentation is outdated. Consider upgrading your project to Spiral Framework 3.14
Edit this page

Internalization - Import and Export

It is possible to export application locale bundles into the following formats:

  • PHP
  • GetText PO
  • CSV
  • JSON

Export Locale

To export application locate bundles run:

php app.php i18n:export en ./

Note
Export en locale into the current directory.

You should observe file messages.en.php created in this directory. To export in alternative formats:

php app.php i18n:export en ./ -d po

This command will export the locale into the GetText format.

Generate Locale

The framework is capable of generating locale files using static code indexation automatically. Run command i18n:index to find all declared stings.

php app.php i18n:index -vv

Import Locale

Import locate into the project by placing files app/locale/{lang} directory. Use GetText, PHP, or JSON formats.