From 07d6c2f5667b45db22b8426ce0f4c948fb3c8cec Mon Sep 17 00:00:00 2001 From: Dave Whiteland Date: Wed, 25 Jun 2014 17:33:05 +0100 Subject: rewrites and fixes --- docs/developers/i18n.md | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'docs/developers') diff --git a/docs/developers/i18n.md b/docs/developers/i18n.md index 51d6cada1..521ca5768 100644 --- a/docs/developers/i18n.md +++ b/docs/developers/i18n.md @@ -22,17 +22,23 @@ Translations live in the project page at [Transifex](https://www.transifex.net/projects/p/alaveteli/) and should be submitted there. -To deploy, say, English and Spanish translations at once: +For example, to deploy English and Spanish translations at once: * Ensure their PO files are at ```locale/en/app.po``` and ```locale/es/app.po``` (for example, by downloading them from Transifex) * Set AVAILABLE_LOCALES to en es - -The ``pot``-file at ``locale/app.pot`` acts as the template for PO files. When -new translation strings have been added to the source, this ``pot``-file can be -updated using the script at ``script/generate_pot.sh``. This looks for new -translatable strings in the source and creates entries in the ``pot``-file. + +To update the `.pot` and `.po` files for each language, run: + + bundle exec rake gettext:store_model_attributes + +followed by: + + bundle exec rake gettext:find + +If `gettext:find` only creates the file `locale/im-config.pot` then you need to +unset the `TEXTDOMAIN` environment variable and try again. For more details about the translations, see the page about [translating Alaveteli]({{ site.baseurl }}docs/customising/translation/). @@ -43,7 +49,7 @@ For more details about the translations, see the page about ### Getting the current locale This is complicated by the fact that there are two competing ways to define a -locale+territory combination. The POSIX (and `gettext` and Transifex) way is +locale+territory combination. The POSIX (and gettext and Transifex) way is like `en_GB`; the Rails way is like `en-US`. Because we are using gettext and Transifex for translations, we must deal with both. Wherever you need to know the Rails version of the currently selected locale, use `I18n.locale`; wherever @@ -70,8 +76,7 @@ _('Browse all or ask us to ad :browse_url => @browse_url, :add_url => @add_url) ``` -Similar rules can apply to strings in the python source code, as long as you -import ```_```, ```n_```, etc. +Similar rules can apply to strings in the Ruby source code. ## Programmatic access of translated PublicBodies @@ -139,11 +144,5 @@ The release manager will enforce a translation freeze just before a new release is cut. During such time, you must not introduce new strings to the code if your work is due for inclusion in this release. This is necessary to allow translators time to complete and check their translations against all the known -strings. - -## I18n in URLs +strings. See more about [translating Alaveteli]({{ site.baseurl }}docs/customising/translation/). -We have tried using the [translate_routes plugin](https://github.com/raul/translate_routes) -to localize URLs. This looks up URL segments as translation strings in a YAML -file at```config/i18n-routes.yml```. However, we no longer use it because we -found it was overly complex. -- cgit v1.2.3