[ python-Bugs-949832 ] Problem w/6.27.2.2 GNUTranslations
ungettext() example code
SourceForge.net
noreply at sourceforge.net
Sat Jul 10 19:17:00 CEST 2004
Bugs item #949832, was opened at 2004-05-07 08:44
Message generated for change (Comment added) made by akuchling
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=949832&group_id=5470
Category: Documentation
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Martin Miller (mrmiller)
Assigned to: A.M. Kuchling (akuchling)
Summary: Problem w/6.27.2.2 GNUTranslations ungettext() example code
Initial Comment:
> Here is an example:
>
> n = len(os.listdir('.'))
> cat = GNUTranslations(somefile)
> message = cat.ungettext(
> 'There is %(num)d file in this directory',
> 'There are %(num)d files in this directory',
> n) % {'n': n}
The last line of code in the example should be:
> n) % {'num': n}
Also, I don't think the example illustrates a realistic
usage of the ungettext() method, as it is unlikely that
the message catalog is going to have different message
id's for all the possible variations of the string each
with a different number of files in them -- exactly the
problem that ungettext() is suppose to address.
A better example would just use ungettext() to pick
either the word "file" or "files" based on the value of
n. It would be more realistic and the example code
would probably be simpler.
----------------------------------------------------------------------
>Comment By: A.M. Kuchling (akuchling)
Date: 2004-07-10 13:17
Message:
Logged In: YES
user_id=11375
Example fixed in CVS and in 2.3 branch; thanks!
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=949832&group_id=5470
More information about the Python-bugs-list
mailing list