On Jun 10, 2007, at 3:57 PM, Diez B. Roggisch wrote:

>
> Hi All,
>
> I've talked a few times about enhancing the TG i18n-support. Now I
> finally had time to produce a first patch for the current 1.0- 
> trunk. It
> should apply to 1.0.2, too.
>
> See ticket #1405 (http://trac.turbogears.org/attachment/ticket/ 
> 1405) for
> an overview & the necessary files/patches.
>
> The enhancements/fixes are essenitally these:
>
> 1) make DateValidation take format as a callable. That was missing  
> andp
> revented locale-dependend date parsing/formatting
>
>
> 2) collect strings from KID-templates in the same way the
> KID-i18n-filter treats them and thus make them subject to i18n.
>
> 3) collect strings from JS-files and create message-catalogs for JS
> which are automatically included using a standard-widget.
>
> Please review & discuss.

Thanks for the patch Diez!

I've tried it out in a freshly quickstarted app (attached at the  
ticket) and looks great. These are the steps I took in case anyone  
wants to try it out:

1) tg-admin quickstart
2) wrote a sample and dumb helloworld.js at ${package}/static/ 
javascript and placed a button at welcome.kid to trigger the function.
3) registered that directory with widgets.register_statict_directory
4) set  tg.include_widget = ["turbogears.jsi18nwidget"]  in app.cfg
5) tg-admin collect
6) generated po in the toolbox
7) tg-admin compile
8) start app and enjoy

Some comments & suggestions:

1) It took me some time to figure out 3. Couldn't the widget or  
something be more clever and do this automatically. I guess it's kind  
of unintuitive for those not using widgets to include their js files  
at the template. Maybe the i18n widget should be just an  
implementation detail and this functionallity work for those not  
using widgets at all.

2) Do you have plans to make this useful for distributing 18n bundles  
with packaged widgets? From the code I guess messages-X.js must live  
inside a TG app but I might be wrong...

Thanks! :)
Alberto

--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to