[ckan-dev] i18n in JS stuff

Friedrich Lindenberg friedrich at pudo.org
Wed Dec 8 10:26:41 UTC 2010


On Dec 8, 2010, at 11:11 AM, Rufus Pollock wrote:

> 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:
>>>> 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
> ...?

No, we would get the HomeController to have a language action which would emit a list of JS variable declarations when called as /language.js. I'm not sure how to get genshi to spill out non-XML text, though. 

> Alternative I would assume is to embed link in template?

True, but that entails a lot of problems. 

Lg, Fr. 


> 
> Rufus
> 
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev





More information about the ckan-dev mailing list