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.

Files for BabelGladeExtractor, version 0.7.0
Filename, size File type Python version Upload date Hashes
Filename, size BabelGladeExtractor-0.7.0.tar.bz2 (8.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page