2012-04-27 17:32:54 +02:00
# Translation Process #
2012-10-09 03:44:30 +02:00
This page covers a few advanced topics related to SilverStripe's translation system.
2012-04-27 17:32:54 +02:00
2012-10-09 03:44:30 +02:00
To find out about how to assist with translating SilverStripe, see the [Contributing Translations page ](contributing/translation ).
2012-05-04 10:19:48 +02:00
2012-06-22 15:07:25 +02:00
## Set up your own module for localization
2012-04-27 17:32:54 +02:00
### Collecting translatable text
As a first step, you can automatically collect
all translatable text in your module through the `i18nTextCollector` task.
See [i18n ](/topics/i18n#collecting-text ) for more details.
### Import master files
2013-08-03 20:18:06 +02:00
If you don't have an account on transifex.com yet, [create a free account now ](http://www.transifex.com/signup ).
After creating a new project, you have to upload the `en.yml` master file as a new "Resource".
While you can do this through the web interface, there's a convenient
[commandline client ](http://support.transifex.com/customer/portal/topics/440187-transifex-client/articles )
for this purpose. In order to use it, set up a new `.tx/config` file in your module folder:
2012-04-27 17:32:54 +02:00
2013-08-03 20:18:06 +02:00
[main]
host = https://www.transifex.com
[my-project.master]
file_filter = lang/< lang > .yml
source_file = lang/en.yml
source_lang = en
type = YML
2012-04-27 17:32:54 +02:00
If you don't have existing translations,
your project is ready to go - simply point translators
to the URL, have them sign up, and they can create languages and translations as required.
### Import existing translations
In case you have existing translations in YML format,
2013-08-03 20:18:06 +02:00
there's a "New language" option in the web interface.
Alternatively, use the [commandline client ](http://support.transifex.com/customer/portal/topics/440187-transifex-client/articles ).
2012-04-27 17:32:54 +02:00
### Export existing translations
2013-08-03 20:18:06 +02:00
You can download new translations in YML format through the web interface,
but that can get quite tedious for more than a handful of translations.
Again, the [commandline client ](http://support.transifex.com/customer/portal/topics/440187-transifex-client/articles )
provides a more convenient interface here with the `tx pull` command, downloading all translations as a batch.
2012-04-27 17:32:54 +02:00
2012-07-13 14:25:44 +02:00
### Merge back existing translations
2013-08-03 20:18:06 +02:00
If you want to backport translations onto release branches, simply run the `tx pull` command on multiple branches.
This assumes you're adhereing to the following guidelines:
2012-07-13 14:25:44 +02:00
2013-08-03 20:18:06 +02:00
- For significantly changed content of an entity, create a new entity key
- For added/removed placeholders, create a new entity
- Run the `i18nTextCollectorTask` with the `merge=true` option to avoid deleting unused entities
(which might still be relevant in older release branches)
2012-07-13 14:25:44 +02:00
2012-04-27 17:32:54 +02:00
### Converting your language files from 2.4 PHP format
The conversion from PHP format to YML is taken care of by a module
called [i18n_yml_converter ](https://github.com/chillu/i18n_yml_converter ).
2013-08-03 20:18:06 +02:00
## Download Translations from Transifex.com
2012-04-27 17:51:38 +02:00
2013-08-03 20:18:06 +02:00
We are managing our translations through a tool called [transifex.com ](http://transifex.com ).
Most modules are handled under the "silverstripe" user,
see [list of translatable modules ](https://www.transifex.com/accounts/profile/silverstripe/ ).
2012-04-27 17:51:38 +02:00
2013-08-03 20:18:06 +02:00
Translations need to be reviewed before being committed,
which is a process that happens roughly once per month.
We're merging back translations into all supported release branches as well as the `master` branch.
The following script should be applied to the oldest release branch, and then merged forward into newer branches:
tx pull
# Manually review changes through git diff
git add lang/*
git commit -m "Updated translations"
2012-04-27 17:32:54 +02:00
2013-08-03 20:18:06 +02:00
You can download your work right from Transifex in order to speed up the process for your desired language.
2012-04-27 17:51:38 +02:00
2012-10-09 03:44:30 +02:00
# Related
2012-04-27 17:51:38 +02:00
* [i18n ](/topics/i18n ): Developer-level documentation of Silverstripe's i18n capabilities
2012-10-09 03:44:30 +02:00
* [contributing/translation ](contributing/translation ): Information for translators looking to contribute translations of the SilverStripe UI.
2012-04-27 17:51:38 +02:00
* [translatable ](https://github.com/silverstripe/silverstripe-translatable ): DataObject-interface powering the website-content translations
* ["Translatable ModelAdmin" module ](http://silverstripe.org/translatablemodeladmin-module/ ): An extension which allows translations of DataObjects inside ModelAdmin