Page MenuHomePhabricator

Replace in-code translations by gettext
Closed, DeclinedPublic

Description

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.


Version: unspecified
Severity: enhancement
See Also:
https://sourceforge.net/p/pywikipediabot/feature-requests/222

Details

Reference
bz55075

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:18 AM
bzimport set Reference to bz55075.
bzimport added a subscriber: Unknown Object (????).
jayvdb set Security to None.
Xqt subscribed.

we have another way with i18n library part.