[New-bugs-announce] [issue36837] Make il8n tools available from `python -m`

Benjamin Kane report at bugs.python.org
Tue May 7 12:23:26 EDT 2019


New submission from Benjamin Kane <bbk1524 at gmail.com>:

Localizing a Python application involves using the `gettext` standard library module to read .mo files. There are three scripts to assist with this in https://github.com/bbkane/cpython/tree/master/Tools/i18n :
- makelocalealias.py : Convert the X11 locale.alias file into a mapping dictionary suitable for locale.py.
- msgfmt.py : Generate binary message catalog from textual translation description
- pygettext.py : Generate .pot files identical to what GNU xgettext[2]
generates for C and C++ code (these can be translated by msgfmt.py)

I recently wrote a tutorial to localize a Python Script ( https://github.com/bbkane/arcade/blob/bbkane/add_localization_example/doc/examples/text_loc_example.rst ) and I had to tell my users (a student audience) to download these scripts from GitHub. I would have been much happier to ask them to use a builtin Python tool available from the `-m` switch (similar to `python -m json.tool`), so this issue is to add that.

The docs ( https://docs.python.org/3/library/gettext.html#internationalizing-your-programs-and-modules ) mention these scripts, but do not provide any information on how to get them.

Possible solutions:

- turn gettext.py into a package and put these scripts into a tool subpackage (similar to json.tool)
- Add a separate package (il8n perhaps) and put these scripts into there
- Add links to these scripts and instructions to use them in the docs.

----------
messages: 341771
nosy: bbkane
priority: normal
severity: normal
status: open
title: Make il8n tools available from `python -m`

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36837>
_______________________________________


More information about the New-bugs-announce mailing list