Skip to main content

version ci coverage license

PyTest Translations

A py.test plugin to check gettext po & mo files.

Test check for:

  • Spelling (using enchant & aspell)

  • Consistency of mo files

  • Obsolete translations

  • Fuzzy translations

Installation

Install the PyPi package.

pip install pytest-translations

The spell checking requires enchant and aspell including the correct dictionary.

On Linux simply install:

sudo apt-get install python3-enchant python-enchant aspell-{en|de|CHOSE YOUR LANGUAGE CODES}

To set up travis-ci simply add the apt packages to your travis-ci config YAML:

addons:
  apt:
    packages:
    - python-enchant
    - python3-enchant
    - aspell-en
    - aspell-de

On Mac you can use brew to install:

brew install aspell
brew install enchant

Usage

To execute the translation tests simply run

py.test --translations

Every file ending in .mo and .po will be discovered and tested, starting from the command line arguments.

You also can execute only the translation-tests by using:

py.test -m translations --translations

Private Word Lists

You will almost certainly use words that are not included in the default dictionaries. That is why you can add your own word list that you want to add to the dictionary.

You may do so by adding a plain text file where each line is a word. Words beginning with a capital letter are case sensitive where lower case words are insensitive.

There can be one file for each language contained in a single folder. The files should be named like the proper language code.

For example:

.
└── .spelling
    ├── de
    ├── en_GB
    └── en_US

What’s left to do is to set an environment variable to point to right directory.

For example:

export PYTEST_TRANSLATIONS_PRIVATE_WORD_LIST=path/to/my/.spelling

Metadata

Release files for pytest-translations 5.0.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 pytest-translations 5.0.0
File Size Uploaded Provenance
pytest_translations-5.0.0.tar.gz 5.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-translations 5.0.0
File Interpreter ABI Platform
pytest_translations-5.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.9 kB

Release files / pytest_translations-5.0.0.tar.gz

Download URL pytest_translations-5.0.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ffd84082f9363350a51a3757a73352a1aadfffd14e7af872df2decc7dfbf4a0e
BLAKE2b-256 checksum
How to use checksums
7b44aa0e2b9046deead9d267a67a6a1e1a392d8ef89e86f3820275c530bf0cdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / pytest_translations-5.0.0-py3-none-any.whl

Download URL pytest_translations-5.0.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fd20a99591714b656281b674e0186a9df485a7d2aedccde2453b5a465f14eec
BLAKE2b-256 checksum
How to use checksums
dfcd28bdeccc0a1a129864b726494f36c9b87ec6a8dadeb90ef9f9ee2114bd9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Security for pytest-translations 5.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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