Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/himdel/lint-po
A simple linter for gettext .po files to catch common translator mistakes.
https://github.com/himdel/lint-po
Last synced: about 2 months ago
JSON representation
A simple linter for gettext .po files to catch common translator mistakes.
- Host: GitHub
- URL: https://github.com/himdel/lint-po
- Owner: himdel
- License: apache-2.0
- Created: 2021-11-24T21:21:27.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-29T12:01:43.000Z (4 months ago)
- Last Synced: 2024-07-17T07:49:10.676Z (2 months ago)
- Language: Python
- Size: 18.6 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### 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 Github Actions error reporting syntax (when `env.GITHUB_ACTIONS` is set)
* supports lingui plural syntax - `msgstr "{count, plural, one {依存関係} other {依存関係}}"` is the one case when the thing in {} needs to change between msgid and msgstr#### Example usage
```sh
$ lint-po locale/*.poDifference 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