[ckan-dev] i18n in JS stuff

Rufus Pollock rufus.pollock at okfn.org
Wed Dec 8 10:11:10 UTC 2010


On 7 December 2010 22:18, Friedrich Lindenberg <friedrich at pudo.org> wrote:
> On Dec 7, 2010, at 10:36 PM, Richard Pope wrote:
>> On Tue, Dec 7, 2010 at 9:24 PM, Friedrich Lindenberg <friedrich at pudo.org> wrote:
>>> Hi all,
>>>
>>> I'm currently adding a few more pieces of i18n to CKAN - many of the form options and html templates are not actually internationalized on closer inspection. While this doesn't kill us with community catalogues, with Helsinki and the Netherlands its a real showstopper.
>>>
>>> Most of these are fixable, but some of them are in JS that doesn't currently go through any i18n filters (e.g. "Add a new resource" js link, "More >" links). Does anyone here have an idea as to how those can be externalized?
>>
>> I think the one time I've been involved with something like this
>> (using php & smarty) we ended up serving a language.js file as a
>> php/smarty file. i.e. using the same system as the html. Would look
>> like:
>>
>> language.js:
>>
>> var WELCOME_MESSAGE = {__($welcome_message)}
>>
>> main.js file:
>>
>> alert(WELCOME_MESSAGE);
>>
>
> As far as I can tell, thats also pretty much what the jquery folks do. Would anyone consider it terrible abuse to channel this through HomeController?

What do you mean chanelled through HomeController? Do you mean
inserting a javacript 'po' file depending on user language pref or
...?

Alternative I would assume is to embed link in template?

Rufus




More information about the ckan-dev mailing list