https://bugzilla.wikimedia.org/show_bug.cgi?id=55075
Web browser: --- Bug ID: 55075 Summary: Replace in-code translations by gettext Product: Pywikibot Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: legoktm.wikipedia@gmail.com Classification: Unclassified Mobile Platform: ---
Originally from: http://sourceforge.net/p/pywikipediabot/feature-requests/222/ Reported by: vvinet Created on: 2009-08-28 20:48:57 Subject: Replace in-code translations by gettext Original description: Having thousands of lines of translations in the text is not very elegant, plus it requires people to look at the code to make translations.
Using gettext could make this a lot easier to manage.
Attached is a patch that changes the family.py to use gettext translations in some places, as well as a simple script to generate and compile translation files.
Since the translation is not dependant on the user's locale, but on the wiki's, the i18n.py file created by the patch allows choosing the language to get the translation from, and then getting the translation string.
In order to translate, "Category" for a French wiki, for example, you just need to do _GT("fr").ugettext("Category") where _GT is a short alias for the get_translation function in i18n.py
The .po file for "fr" language code is partly filled up for some of the translations.
Sorry if this does not cover all strings so far. It only covers those I needed so far. If there is interest for this feature, I can help to continue the integration, as well as automatically generate the .po files for every language based on the current namespace dictionary.
https://bugzilla.wikimedia.org/show_bug.cgi?id=55075
--- Comment #1 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- Patch to use gettext
https://bugzilla.wikimedia.org/show_bug.cgi?id=55075
Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://sourceforge.net/p/p | |ywikipediabot/feature-reque | |sts/222
pywikipedia-bugs@lists.wikimedia.org