-
Notifications
You must be signed in to change notification settings - Fork 27
Internationalization
Conductor uses the fast_gettext: https://github.com/grosser/fast_gettext and fast_gettext integration gem for rails gettext_i18n_rails : https://github.com/grosser/gettext_i18n_rails
To translate a string use:
_("Foo")
To translate string with a parameter use:
_("Bar %s") % param
To translate string with more than one parameters use:
_("Foo %s and %s") % [param1, param2] OR _("Params %{a} and %{b}") % {:a => "Foo", :b => "Bar"}
Tell to gettext - this string need translation (found during parsing, usage i.e. constant string, validation messages):
N_("FooBar")
To translate pluralized:
n_("Apple","Apples",count)
For date and time we use default Rails i18n API:
t('datetime.distance_in_words.x_months', :count => months)
All default translation dictionary is located in
src/config/locales/default/en.yml
Be sure that added string contains no interpolation.
i.e. for instance states we used
t("instances.states.#{instance.state}")
but it have to be like for gettext format
_(instance.state)
where all states are defined somewhere in project (via gettext method N*). Be sure that your string followed PO file entry’s schematic structure:
msgid untranslated-string
msgstr translated-string
When you add some new string/s use:
$ rake gettext:find
When you add new attribute to the model use:
$ rake gettext:store_model_attributes
then to add new attributes to .pot/.po files:
$ rake gettext:find
If you want to create new .po file for specific language use:
$ rake gettext:add_language[de]
New translations will be marked fuzzy, search for this and remove it, so that they will be used. Obsolete translations are marked with ~#, they usually can be removed since they are no longer needed.
We are using Zanata project https://translate.zanata.org/zanata/ . Here you can find information about starting to contribute in translations.
Our dictionaries contributors can find here: https://translate.zanata.org/zanata/project/view/aeolus-conductor
Zanata accepts PO file format.
- has an account in FAS
- be a maintainer of https://translate.zanata.org/zanata/project/view/aeolus- conductor
- when you’re a maintainer need to set
USERNAME
andKEY
in your~/.config/zanata.ini
- installed
zanata-python-client
- command line tool for working with Zanata
Create a new version of aeolus-conductor
$ zanata version create VERSION*\#
Set languages that en.yml
will be translated to, then download
zanata.xml
(AFAIK It can be downloaded only through UI)
Push to Zanata (from dir where you have zanata.xml
file stored)
$ zanata push --project-type podir --srcdir path_to_directory_with_po_files
Pull from Zanata (from dir where you have zanata.xml
file stored)
$ zanata pull --project-type podir
Only admin of Zanata project can upload the dictionaries for
translation, for more questions please ask on IRC #aeolus
.