[Zope3-dev] i18n, unicode, and the underline

Gary Poster gary@modernsongs.com
Thu, 10 Apr 2003 17:58:39 -0400


Fred L. Drake, Jr. wrote:
> Gary Poster writes:
>  > Having to write
>  > 
>  >      _(u"Name")
> ...
>  > Ever-so-slightly better:
>  > 
>  >      _("Name")
> 
> Excellent!  I'd also suggest that things like zope.schema.Field accept
> ASCII strings as non-Unicode strings, and convert internally if
> necessary.  Avoiding excess decoration is good.

That might be even better.

If I remember correctly, though, we're supposed to be able to regex 
through the actual Python files to extract the display text from the 
files.  The compilation of this text is the file that is supposed to be 
submitted to a professional translator for an application.  The "_(" 
pattern is supposed to be the hook that makes the regex reliable-ish.

Could we instead have some zcml that makes the ZopeMessageIdFactory base 
class keep track of the text that it is given as the code loads, 
instead, to be spit out as a file or somesuch?  Or is that impractical 
for another reason?  If we could do this, we could have some helpers, 
like the Field code.

Or is this too much DWIM ("Do what I mean")?

Gary