You can translate the website online on Transifex: https://www.transifex.com/projects/p/elementary-mvp/. Please don't update directly files in lang/
on Github as they'll be overriden when pulling new translations from Transifex.
You can propose new languages if they're not listed. Make sure to avoid requesting languages that already exist, for instance adding Russian (Russia) when Russian is available.
Please read the branding guidelines before translating and pay attention to spelling mistakes.
It's not a good practice to review strings translated by ourselves. Instead, find someone else speaking your language and ask him to join the reviewers team (you can send a message to emersion to ask this).
Languages are manually updated, so you won't see your work published just after you submitted it (see Pull translated files from Transifex).
Translations strings are extracted from HTML files. A little PHP script analyzes HTML files and exports strings to a JSON file: /backend/extract-l10n.php?page=<page>
. You can change the page
parameter to extract translations from another page (and set it to layout
to translate the website layout). Translations are auto-updated on Transifex using this script.
You can add the include_disabled=1
parameter to print disabled strings too. This behaviour is disabled by default because Transifex doesn't accept false
values. See Disabling a translation for more information.
If you want to change a translation key for an element, just add a data-l10n-id
attribute:
<p data-l10n-id="mylongparagraph">Blablabla</p>
To ignore a translation string, set it to false
in /lang/en/<page>.json
:
{
"elementary OS": false // Can't be translated
}
Alternatively, you can add the data-l10n-off
attribute to a tag:
<p data-l10n-off="1">I'm ignored.</p>
You will need first to install the Transifex client: http://docs.transifex.com/developer/client/setup
Then, run the following command:
tx pull
To pull a new language:
tx pull -l <lang>
To pull all translations, even new ones:
tx pull -a
When creating or updating a source file, translations needs to be updated. You can run these commands to extract translations from source files and publish them on Transifex:
.tx/prepush.sh # Update translation source files
tx push -s # Push new translation source files to Transifex
If you know that you modified only one source file, it's better to push only this one:
tx push -s -r <page-name>
The list of available languages is hard-coded in _templates/l10n.php
. If a new language is complete, you can add it by appendding it to the list. Languages are sorted by index (see ISO 639-1) and are localized.