https://bugzilla.wikimedia.org/show_bug.cgi?id=55109
--- Comment #8 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- Logged In: YES user_id=687283 Originator: NO
Check http://svn.wikimedia.org/viewvc/pywikipedia/branches/pywikipedia/i18n/input%... and see if you like it. I wrote a new function; the system is as follows:
retval = i18nChoice("Do you want to save?", "[('yes', 'y'), ('no', 'n')]", 'yes')
instead of a key, the options *name* is given as parameter, and returned.
This returns, with a dutch translation: Wilt u opslaan? ([j]a, [n]ee) n
then retval == 'no'
To use this, we need to use xgettext: xgettext --keyword=i18nChoice:1,2 ic.py
and we get plural defenitions: msgid "Do you want to save?" msgid_plural "[('yes', 'y'), ('no', 'n')]" msgstr[0] "Wilt u opslaan?" msgstr[1] "[('ja', 'j'), ('nee', 'n')]"
Maybe not the nicest solution, but the best one I could find. The alternative would be retval = i18nChoice(_("Do you want to save?"), "[('yes', 'y'), ('no', 'n')]", 'yes') with xgettext --keyword=i18nChoice,2 ic.py (and the corresponding changes in the function, of course.)