Em Terça 30 Maio 2006 03:22, Max Ischenko escreveu:
> Hi all,
>
> Please correct me if I'm wrong, but there is no standard approach to handle
> localization (gettext) in JavaScript. Basically, the developer has to
> struggle on his own to find a solution that will work for the application
> at hand. So, if you have any experience doing this please share it, either
> here or off-list.

Hi Max!


I was thinking the same thing another day.  My conclusion was: "Why am I 
creating HTML in pure JavaScript?  Why am I not using widgets or a template 
for that?"

You see, if we use templates and return HTML fragments that are replaces with 
a .innerHTML then all the I18N process is done the same way it is done for 
our pages.  There's no difference at all.  The same goes for widgets...

If you can't use .innerHTML for some reason then I'd suggest returning JSON 
with all the text and using MochiKit.DOM to put things into their place.  
This will make it I18Nizable inside your controller, as is done with your 
other code.

Apart from that, you can use the LocalizableJSLink widget and create your 
interface for each language inside it.  Using the same name for functions and 
providing the same resources you'd it.  This is how the CalendarWidget works 
and it looks like how other applications written outside of TG do it with 
their JS...


Be seeing you,
-- 
Jorge Godoy           <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to