Skip to main content

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 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

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.3.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

lint_po-0.1.3-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file lint-po-0.1.3.tar.gz.

File metadata

  • Download URL: lint-po-0.1.3.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for lint-po-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ec90af93ed282306a3b87eb50a9f1e672f2467b031cc7edabb4b74036bfdad97
MD5 1f86e0fd9e4c26f063dc7e3830f1b59c
BLAKE2b-256 3cd6e346a83dfdaea72cdeb2a730191096eb4a47035d0d085396d4b7ccb337f3

See more details on using hashes here.

File details

Details for the file lint_po-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: lint_po-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for lint_po-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 58761b0e98a8f224132dd320be728968c28fd2ccabaa789a6909256c343247fa
MD5 ae7c8f21e1e894fc7eb919155386c377
BLAKE2b-256 235243b82add8118ddc462aca0a9080e1c221bef4b1328b0ead3c8cff72e710d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page