Last modified: 2013-10-05 04:20:38 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T57075, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55075 - Replace in-code translations by gettext
Replace in-code translations by gettext
Status: NEW
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
unspecified
All All
: Unprioritized enhancement
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-05 04:20 UTC by Kunal Mehta (Legoktm)
Modified: 2013-10-05 04:20 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kunal Mehta (Legoktm) 2013-10-05 04:20:33 UTC
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.
Comment 1 Kunal Mehta (Legoktm) 2013-10-05 04:20:35 UTC
Patch to use gettext

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links