Re: FormEncode i18n translation integration in TurboGears

Gregor Horvath <gh-LfrpOBifzZo+ytmZ3SK/[email protected]>
Newsgroups gmane.comp.python.formencode,gmane.comp.web.turbogears
Organization Ing. Gregor Horvath, Industrieberatung & Softwareentwicklung
Message-ID <[email protected]>
Ian Bicking schrieb:

> 
> That would be fine, but for this case we might also just put
> "gettext_domain='FormEncode'" into the class too, no?  It seems
> reasonable to set the domain to 'FormEncode' by default.
> 

yes, but the standard gettext function does not accept a domain argument
like the TG gettext function does. Instead the domain is definied at
creation time of the translation object:

import gettext # standard
t = gettext.translation(domain='FormEncode', \
                            languages=None, \
                            fallback=True)
_stdtrans = t.ugettext


from http://docs.python.org/lib/node735.html

ugettext(message)
    Look up the message id in the catalog and return the corresponding
message string, as a Unicode string.


TG accepts a domain argument for gettext:

def gettext(key, locale=None, domain=None):
    """Gets the gettext value for key. Added to builtins as '_'. Returns
Unicode string."""

Therefore the gettext_domain argument (or more generally gettextargs)
must be a empty dict in case of standard translation.

--
Greg, Vienna

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.