Skip to main content

Introduction

This package contains a set of tools to help manage translations in Python software.

Babel extraction plugins

lingua contains two extraction plugins for Babel:

Detailed information on using Babel extraction plugins can be found in the Babel documentation.

Translating via spreadsheets

Not all translators are comfortable with using PO-editors such as Poedit or translation tools like Transifex. For them lingua has simple tools to convert PO-files to xls-files and back again. This also has another benefit: it is possible to include multiple languages in a single spreadsheet, which is helpful when translating to multiple similar languages at the same time (for example simplified and traditional chinese).

The format for spreadsheets is simple: the first column lists the canonical text, and all further columns contain a translation for the text, with the language code on the first row. Fuzzy translations are marked in italic.

Converting one or more PO-files to an xls file is done with the po-to-xls command:

po-to-xls -p nl nl.po texts.xls

This will create a new file texts.xls with the Dutch translations. The -p parameter can be given multiple times to include more languages:

po-to-xls -p zh_CN zh_CN.po -p zh_TW zh_TW.po -p nl nl.po texts.xls

This will generate a file with all simplified chinese, traditional chinese and Dutch translations.

Translations can be merged back from a spreadsheet into a PO-file using the xls-to-po command:

xls-to-po nl texts.xls nl.po

This will take the Dutch (nl) translations from texts.xls and use those to upgrade the nl.po file.

Sanity checking

Lingua includes a simple polint tool which performs a few basic checks on PO files. Currently implemented tests are:

  • duplicated message ids (can also be checked with msgfmt). These should never happen and are usually a result of a bug in the message extraction logic.

  • identical translations used for multiple canonical texts. This can happen for valid reasons, for example when the original text is not spelled consistently.

To check a po file simply run polint with the po file as argument:

polint nl.po

Translation:
    ${val} ist keine Zeichenkette
Used for 2 canonical texts:
1       ${val} is not a string
2       "${val}" is not a string

Changelog

1.0 - September 8, 2011

  • Update XML extractor to ignore elements which only contain a Chameleon expression (${....}). These can happen to give the template engine a hint that it should try to translate the result of an expression. This fixes issue 2.

  • Update XML extractor to not abort when encountering undeclared namespaces. This fixes issue 3.

  • Fix Python extractor to handle strings split over multiple lines correctly.

1.0b4 - July 20, 2011

  • Fix po-to-xls when including multiple languages in a single xls file.

1.0b3 - July 18, 2011

  • Paper brown bag: remove debug leftover which broke po-to-xls.

1.0b2 - July 18, 2011

  • Update PO-XLS convertors to allow selection of comments to include in the xls files.

  • Correct XML extractor to strip leading and trailing white. This fixes issue 1.

  • Add a very minimal polint tool to perform sanity checks in PO files.

  • Update trove data: Python 2.4 is not supported due to lack of absolute import ability.

1.0b1 - May 13, 2011

  • First release.

Metadata

Release files for lingua 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lingua 1.0
File Size Uploaded
lingua-1.0.tar.gz 12.0 kB Details

Release files / lingua-1.0.tar.gz

Download URL lingua-1.0.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a27e5c0c8f9d609f27c4c9aa04a36a23fb5441488d3ff3e46c077b2ed0624e21
BLAKE2b-256 checksum
How to use checksums
0d3ef699dc54fa14a012ad6dd50faa888887c5183d02d9d3d81787aa347371ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

4.16.2

2 release files

4.16.1

2 release files

4.16.0

1 release file

4.15.0

2 release files

4.14

2 release files

4.13

2 release files

4.12

2 release files

4.11

2 release files

4.10

2 release files

4.9

2 release files

4.8.1

2 release files

4.8

2 release files

4.7

2 release files

4.6

2 release files

4.5.1

2 release files

4.5

2 release files

4.4

2 release files

4.3.1

2 release files

4.3

4.2

2 release files

4.1

2 release files

4.0

2 release files

3.12

2 release files

3.11

2 release files

3.10

2 release files

3.9

2 release files

3.8

2 release files

3.7

2 release files

3.6.1

2 release files

3.6

2 release files

3.5.1

2 release files

3.5

2 release files

3.4

1 release file

3.3

1 release file

3.2

2 release files

3.1

2 release files

3.0

2 release files

2.5

2 release files

2.4

3 release files

2.3

3 release files

2.2

3 release files

2.1

1 release file

2.0

1 release file

1.6

1 release file

1.5

1 release file

1.4

1 release file

1.3

1 release file

1.2

1 release file

1.1

1 release file

This release

1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page