Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

turtle-translations

Translations of the docstrings of Python's turtle module.

Working with translations

Translations live in gettext catalogs in the po/ directory.

Extracting the template

The template is extracted from the turtle module of the Python you run the script with, so use the latest Python version available:

$ python scripts/i18n.py extract
po/turtle.pot: 103 docstrings from Python 3.16.0a0

Adding a language

Create a new catalog from the template for your language:

$ python scripts/i18n.py init ga
Created: po/ga.po

You can now translate it with your tool of choice.

Updating the catalogs

After re-extracting the template against a newer Python, merge the changes into the existing catalogs:

$ python scripts/i18n.py update            # all languages
$ python scripts/i18n.py update pl ga      # specific languages

Docstrings whose original text changed are fuzzy-matched by default and marked #, fuzzy for review. Fuzzy entries are not shipped until the flag is removed. Pass --no-fuzzy to skip the matching and --drop-obsolete to delete entries that no longer exist in the template rather than keeping them commented out.

Checking progress

$ python scripts/i18n.py stats
pl           42/103 translated (40%), 3 fuzzy

Compiling

Each PO file compiles to a top-level turtle_docstringdict_<lang>.py module containing a docsdict, which is what turtle imports. Untranslated and fuzzy entries are left out so their help stays English. When imported, the module drops entries for names that do not exist in the running version of turtle, so a single module built from the newest Python works on older ones too.

The modules are built automatically when the wheel is built, so you normally only need this to test locally:

$ python scripts/i18n.py compile
Compiled: turtle_docstringdict_pl.py

About

Translations of the docstrings of Python's 'turtle' module.

Resources

Code of conduct

Security policy

Stars

2 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages