Use gettext
/Babel
/i18n-generator
for true i18n support in xclim UI
#271
Labels
gettext
/Babel
/i18n-generator
for true i18n support in xclim UI
#271
Addressing a Problem?
Xclim presently offers translations of indicator metadata. The method by which we perform this currently is a YAML file of mappings, with some special features to handle conjugations and gender of words when mapped (for French, currently). This approach (or the promising approach using jinja2, as detailed in Ouranosinc/xclim#1120) is adequate for now, seeing as indicator metadata is highly conditional and complex.
Outside the metadata translations, the internal documentation and all output messages remain in English, but they could be translated using a very standardized/Pythonic approach. Worth investigating?
Potential Solution
Existing tools in the Python standard library and in PyPI have been developed specifically for addressing these needs:
gettext
str
classes) to be locale-dependent. This library gives us the low-level functionality that handles translations.Babel
locale
and other factors. Has support for date-time with timezone conversion, number format parsing/reformatting (1,000
→1.000
), and means of providing installation options that are locale-dependent.i18n-generator
One potential approach would be to perform the following:
gettext
string class.Babel
to generate catalogue mappings for all affectedstr
instances.i18n-generator
.Babel
-based language conversion into thesetup.py
ofxclim
.The result of this process will be that
xclim
's UI, history output, logs, etc. can now reflect the language of the environment (or manually overridden) for a much more consistent UX.Additional context
python-i18n
is unmaintained, but 100% of the process can be done with above-mentioned tools and similar approach as detailed in guide)Resources:
Contribution
Code of Conduct
The text was updated successfully, but these errors were encountered: