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 |
---|---|
Arabic | ar |
Azerbaijani | az |
Czech | cs |
Danish | da |
German | de |
German (Swiss) | de_CH |
English | en |
Spanish | es |
Persian | fa |
French | fr |
Hungarian | hu |
Indonesia | id |
Italian | it |
Japanese | ja |
Malaysia | ms |
Norwegian | nb |
Dutch | nl |
Polish | pl |
Portuguese | pt |
Portuguese (Brazil) | pt_BR |
Russia | ru |
Slovene | sl |
Swedish | sv |
Turkish | tr |
Ukrainian | uk |
Vietnamese | vi |
Chinese | zh_CN |
Chinese (Taiwan) | zh_TW |
Translations are community contributed so may you find them to be incomplete shortly after an update.
Translations not covered by Statamic
Although Statamic's translations cover most of the strings in the Control Panel, there are a couple of places where Statamic will fallback to your applications's translations.
One example of this is on Statamic's authentication pages. Since it's using Laravel's built-in authentication under the hood, translations for any validation errors will be pulled from your app's lang
or resources/lang
directory.
To save you manually translating Laravel's strings yourself, you can copy the necessary translations from the community-driven Laravel-lang repository into your application.
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
- Add the language to the array in CorePreferences so it's selectable
- 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
This command will also update existing files with any changes from recent Statamic releases.
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