> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Kenneth > M. Sternberg > Sent: Thursday, July 01, 2004 1:04 PM > To: [EMAIL PROTECTED] > Subject: [Webware-discuss] Internationalization > > > Hi, I'm kinda new to Webware and I'm working on an app that needs to be > both internationalized and Section 508 (Americans with Disabilities Act) > compliant. Most of that is HTML related, but I have a question about > internationalization. > > I'd like to ensure that the the i18n function provided by the gettext > module is universally available inside my application. However, I find > myself continually refactoring the i18n function (the underscore > function, _() ) upwards and not getting relief; if I stop and restart > webware, the i18n definition can get "lost" to resources outside my > application heirarchy-- resources such as FormKit validators. > > To compensate for this, I have become sorely tempted to install the > underscore function directly into the interpreter, and directly at > startup by modifying my local Launch.py: > > import gettext > import __builtin__ > > # install i18n call into PyVM > __builtin__.__dict__['_'] = gettext.gettext > > Is there any reason I should not do this? > > -- > Kenneth M. Sternberg <[EMAIL PROTECTED]> > >
Check out the localization tutorial in the Wiki: http://wiki.webwareforpython.org/multilanguagesitewithgettext.html I recently used that info to help push out a french version of Tablet Hotels. http://www.tablethotels.com/redirect/fr, soon to be tablethotels.fr, use links at the bottom-right of the homepage to switch languages. If your application needs to change languages at the user level (ie user's choice which language they view), you'll need to switch to the correct gettext function (ie "_") at runtime, and the above tutorial describes a model to do that. If you are installing your app in different locations, where each location uses 1 and only 1 language, then you should be able to do as you suggest and install gettext as a global method using the default language for that installation. - Ben ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
