Configuration
Set which language you want to use by default in config/app.php
. You may also choose a fallback locale in case new content and strings are added to the control panel before an accompanying translation has been updated.
'locale' => 'es','fallback_locale' => 'en',
Per-User Override
You can override the translation locale on a per-user basis by setting locale: {code}
in a given user's preferences (their YAML record).
# users/[email protected]name: Nosmo Kingsuper: truepreferences: locale: en
Available Translations
Language | Code |
---|---|
Czech | cs |
Danish | da |
German | de or de_CH |
English | en |
Spanish | es |
French | fr |
Hungarian | hu |
Indonesia | id |
Italian | it |
Malaysia | ms |
Norwegian | nb |
Dutch | nl |
Polish | pl |
Portuguese | pt |
Russia | ru |
Slovene | sl |
Swedish | sv |
Taiwan | zh_TW |
Turkish | tr |
Translations are community contributed so may you find them to be incomplete shortly after an update.
Contributing a New Translation
There are 4 steps.
- Clone
statamic/cms
locally - Run
composer install
- Generate a new translation from source files
- Translate new message files in
resources/lang
- Commit changes and submit a PR
Generating Translation Files
Run the translator generate
command in the statamic/cms
project, along with the new language code as an argument. This will generate empty JSON and PHP files in resources/lang
ready to be translated into the locale of your choice.
You can specify a short 2 character language code (es
) or the full 4 character regional code (es_MX
).
It is recommended that you comply to the language code standard
.
php translator generate eo
- The JSON file contains all the "short strings" established on the fly with the translation helpers, e.g.
__('Cowabunga')
. - The PHP files contain longer strings and are well organized by section of the control panel.
- Translatable strings can contain a
|
to separate singular and plurals. - Translatable strings can contain the
:something
format to indicate a variable.
resources/lang/|-- eo/| |-- markdown.php| |-- messages.php| |-- permissions.php| |-- validation.php|-- eo.json
Using Google Translate
You can get a translation kickstarted with the Google API by passing your API key.
php translator generate eo --key=abc123
Using the Reviewer
Running the translator review
command will loop through all the translations showing you the key, the English phrase, and new translated phrase for proofreading. You can enter new translations during this process. You can also use this command to gather new or changed translatable strings after a Statamic update.
php translator review eo messages