Test your translation files.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytest-translations-4.0.1.tar.gz
.
File metadata
- Download URL: pytest-translations-4.0.1.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f2cd5d32f05629f500124297bb1917e1278a2f08f353986421675d08f9f03ee |
|
MD5 | d49e792ef25b5cf2f48970322b2ce97e |
|
BLAKE2b-256 | c203218ca7e580ec679a20f74598109e9025aa360928c4dc0dafb2df3528d110 |
File details
Details for the file pytest_translations-4.0.1-py3-none-any.whl
.
File metadata
- Download URL: pytest_translations-4.0.1-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9c32c4c7fa5f255dae5890fab173f2d3eb87b9664ab2e20444c2450e985422e |
|
MD5 | 3e3fb57de025d480af1fa9f14c2c178f |
|
BLAKE2b-256 | 7d1bbee9f5649b85798a619aa235fb87b0770e46ecb4930078f1a6cdddaa4771 |