عبدالله شلي (Abdellah Chelli) <sneets...@gmail.com> added the comment:
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) === ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8359> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com