Skip to main content

Babel l10n support for Glade, GtkBuilder, and .desktop files

Project description

BabelGladeExtractor

This package contains message catalog extractors for the following formats, extending Babel so it can handle them.

Getting started

To make these formats translatable, install this package using pip:

pip3 install BabelGladeExtractor

Then in your own projects, map some source and data files to the simple extractor names "glade" and "desktop" that are provided by this package. In your setup.py, add a section like

[extract_messages]
mapping_file = babel.cfg
output_file = subdir/myproject.pot
input_dirs = .

Next, create a separate babel.cfg file, and add sections to it for each format you want to translate.

[glade: **.ui]

[desktop: **.desktop]

You can then use Babel's setuptools integration or its command line interface for your routine i18n lifecycle tasks.

python3 setup.py extract_messages

There's a lot more to it than this, naturally. See Babel's extensive Working with Message Catalogs documentation for a detailed explanation of how to get translatable strings into your Python code.

In Glade 3.22, when you are editing a string property in a sidebar, click the edit icon on the right hand side of the text entry. In the dialog that pops up, enter the text in the main text box, and make sure that the Translatable checkbox is ticked. You can also add some helpful context or comments for your translators if you need to give them a hint. BabelGladeExtractor will handle the corresponding XML attributes appropriately when it extracts strings for translation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

babelgladeextractor-0.7.2.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

babelgladeextractor-0.7.2-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file babelgladeextractor-0.7.2.tar.gz.

File metadata

  • Download URL: babelgladeextractor-0.7.2.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for babelgladeextractor-0.7.2.tar.gz
Algorithm Hash digest
SHA256 f0b5a6b1030f6e05f451b66577bee6d965e7e1547ee3a96f7caa0d949fc636fd
MD5 8dbaddb9c9224de99da8daf20adf4963
BLAKE2b-256 e4b39343c2a44d2dd1cf21ceed95c1b68fa262393ac7f31e96f0a2e5d9013b7c

See more details on using hashes here.

File details

Details for the file babelgladeextractor-0.7.2-py3-none-any.whl.

File metadata

File hashes

Hashes for babelgladeextractor-0.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8bc401cd747162dadae754dabacc4f9b2a7254032d295120c2d9ca29b01acd92
MD5 77118b512d044434447d60228f00e574
BLAKE2b-256 8525a09feebde146eb8571736036979fd0eb80562482be0c5684cc5634b7d350

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page