This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sneetsher
Recipients eric.smith, georg.brandl, sneetsher
Date 2010-04-10.13:26:35
SpamBayes Score 0.00019745088
Marked as misclassified No
Message-id <1270905997.55.0.741406429122.issue8359@psf.upfronthosting.co.za>
In-reply-to
Content
The full example:
===
import gettext

gettext.bindtextdomain("pygettext_test","./locale")
gettext.textdomain("pygettext_test")
_=gettext.gettext
n_=gettext.ngettext

n1=1
n2=3

print n_("there is %i command","there are %i commands",n1) % n1
print n_("there is %i command","there are %i commands",n2) % n2
===

the result of n_("there is %i command","there are %i commands",n2) will be:

"there is %i command"
or
"there are %i commands"
or
different string from translation file in case of other language then English as in Arabic we have 6 forms, 3 of them don't include %i.

"لا يوجد أي أمر"
"يوجد أمر واحد"
"يوجد أمران"
"يوجد %i أوامر"
"يوجد %i أمرا"
"يوجد %i أمر"

(You may not see the Arabic well aligned because it's a RTL language).

So format string is open to fit all languages.
That's why mapping good only for predefined strings.

Then these will be our solution:
===
print n_("there is {0} command","there are {0} commands",n1).format(n1)
print n_("there is {0} command","there are {0} commands",n2).format(n2)
===
History
Date User Action Args
2010-04-10 13:26:37sneetshersetrecipients: + sneetsher, georg.brandl, eric.smith
2010-04-10 13:26:37sneetshersetmessageid: <1270905997.55.0.741406429122.issue8359@psf.upfronthosting.co.za>
2010-04-10 13:26:35sneetsherlinkissue8359 messages
2010-04-10 13:26:35sneetshercreate