A simple gettext .po linter to check for mangled variable names in translations
Project description
lint-po
A simple gettext .po linter to check for mangled variable names in translations.
Features
- reads utf-8 encoded *.po files
- skips
msgid/msgstr
pairs where either value is unset - compares original/translation pairs for common interpolation markers:
- supports
{name}
,{123}
,<123>
,</123>
,<123/>
,%(name)s
- ensures both messages use the same set of variables - no renames, no removals, no additions
- supports
- supports Github Actions error reporting syntax (when
env.GITHUB_ACTIONS
is set)
Example usage
$ lint-po locale/*.po
Difference between msgid="Hello {name}" and msgstr="Bonjour {nom}":
Missing from msgstr: {name}
Unexpected in msgstr: {nom}
at problem.po:2
TODO
- catch nesting errors (<0><1></0></1>), reordering is fine but nesting still needs to make sense
- ensure positional counts (3x %s vs 4x %s, etc.)
- build: autoincrement version for releases
- check headers, Language:
should match the filename
msgstr "{count, plural, one {依存関係} other {依存関係}}"
is the one case when the thing in {} needs to change between msgid and msgstr
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
lint-po-0.1.4.tar.gz
(7.4 kB
view details)
Built Distribution
File details
Details for the file lint-po-0.1.4.tar.gz
.
File metadata
- Download URL: lint-po-0.1.4.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 086e02c879d26aa11c62c56f770107d76bdb6d5e966d6a673214172c04383d58 |
|
MD5 | 9882eecc1f4986deb4325123de5afea3 |
|
BLAKE2b-256 | 5507fe2a01ebcdc2ba0f1dee53c2146d331204f3eacd025f173d76772155164b |
File details
Details for the file lint_po-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: lint_po-0.1.4-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca19d7465ec5bb9cff3fbb42c290da48f25bfb62987d2b926d8b80dfaafa6e4b |
|
MD5 | 5437f9542e625b653dd00f75510be53d |
|
BLAKE2b-256 | cfa15763aa6397b941df87ed0f7d101d8da6f4536213254651241f8f9bb20240 |