[ckan-dev] 2375-demo-theme code review

Sean Hammond sean.hammond at okfn.org
Sat Sep 8 17:42:59 UTC 2012


> > lib/cli.py TranslationsCommand
> 
> New `trans` paster command, the js command seems to make files for each
> language in ckan/public/base/i18n/ like this:
> 
>     {
>         "": {
>             "domain": "ckan",
>             "lang": "de",
>             "plural-forms": "nplurals=2; plural=(n != 1)"
>         }
>     }
> 
> What are these files for? Maybe a better docstring than "generate the
> javascript translations", the files that it generates don't contain any
> translations. I guess this is part of the new system for handling
> translations in javascript but I don't know anything about this system.
> Maybe this is something I missed from the workshop in London. Maybe you
> could give me a couple of pointers to get started understanding how this
> works?

Ah, working on a Saturday. I looked at this a little closer and it seems
once I created a pot file and everything that these
ckan/public/base/i18n/*.js files do actually contain translations to
different languages, but only for a few strings, I guess only the ones
that appear in javascript.

So my guess is that Babel extracts strings from the javascript source
into the po files, and this trans js command finds the translated
strings in the po files and puts them in these i18n/*.js files for the
js code to find them when it needs them at run time?

I'll look at this some more later




More information about the ckan-dev mailing list