Skip to content

Latest commit

 

History

History
105 lines (70 loc) · 3.97 KB

TRANSLATE.md

File metadata and controls

105 lines (70 loc) · 3.97 KB

Translators

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.

Reviewing

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).

Updating

Languages are manually updated, so you won't see your work published just after you submitted it (see Pull translated files from Transifex).

Web developers

Script

The following script will update your local copy of master, push new strings to Transifex, then remove and re-download the translation files. Finally, it will check the translations and push the branch. You should then file a pull request against that branch, including the check result.

git checkout master
git pull
.tx/prepush.sh
tx push -s
git checkout -b translations-update
rm lang/* -Rf
tx pull -a
php backend/translations-checker.php
git add -A
git commit -am "Update all Translations, even new ones"
git push --set-upstream origin translations-update
git checkout master

Extracting translations from HTML files

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.

Changing a translation key

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>

Disabling a translation

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>

Pull translated files from Transifex

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

Pushing new translation source files to Transifex

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>

Adding a new language to the list on the website

The list of available languages is hard-coded in _templates/l10n.php. If a new language is complete, you can add it by appending it to the list. Languages are sorted by index (see ISO 639-1) and are localized.