#2363: Formencode i18n not work with turbogears
------------------------+---------------------------------------------------
 Reporter:  victorlin   |       Owner:                  
     Type:  defect      |      Status:  new             
 Priority:  normal      |   Milestone:                  
Component:  TurboGears  |     Version:  2.0b7           
 Severity:  normal      |    Keywords:  i18n, formencode
------------------------+---------------------------------------------------
 I try to i18n my turbogears2 application. Including error message of
 formencode. But however, I do set the locale with

 {{{
         formencode.api.set_stdtranslation(
             domain="FormEncode", languages=["zh_TW"])
 }}}

 in __call__ of BaseController, but error messages are still english. I
 find out that formencode use state from turbogears2 to do translation.

 And the translation function turbogears2 provided does not work with
 formencode.

 I can't see why turbogears2 provide its own pylons_formencode_gettext
 rather than use pylons_formencode_gettext of pylons directly.

 I try to modify that function tg2 provied, and everything works fine.
 These are code I modified:

 {{{
 def pylons_formencode_gettext(value):
     from pylons.i18n import ugettext as pylons_gettext
     from gettext import NullTranslations
     from formencode import api

     trans = pylons_gettext(value)

     # Translation failed, try formencode
     if trans == value:
         trans = api._stdtrans(value)
 }}}

 As you see, I just do what pylons do. And everything works fine.

-- 
Ticket URL: <http://trac.turbogears.org/ticket/2363>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to