Alex Grönholm
unread,Apr 24, 2011, 12:32:09 PM4/24/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Python Babel
When attempting to define a "better" gettext function that would call
either ugettext or ungettext based on the number of arguments, I ran
into several problems. First of all, the syntax for specifying keyword
argument list lengths is undocumented. Browsing the Babel source, I
figured out that the syntax was _:x,y where x and y are indices that
tell which arguments contain the extractable strings. My second
problem, however, was the fact that extract() checks the number of
arguments and if it does not exactly match the specification, it would
drop the string from the first argument. This can be easily fixed by
removing line 293 from babel/messages/extract.py (v0.9.6), preventing
it from marking the entry as invalid. After this modification the
variable argument gettext function worked beautifully. Any chance that
this modification could be added to the main codebase?