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

$ 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

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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lint_po-0.1.5-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file lint_po-0.1.5.tar.gz.

File metadata

  • Download URL: lint_po-0.1.5.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lint_po-0.1.5.tar.gz
Algorithm Hash digest
SHA256 3e67ed31568163a9a9e1770dce7ce543dc120a576da17e8343a478763b732213
MD5 6f8a9f2544b9790a1a53c11b16f6bb5a
BLAKE2b-256 3e4b31ee4d62c31262d6d891381882df2bfd64cf8473c7deca40d41881fe9b49

See more details on using hashes here.

Provenance

The following attestation bundles were made for lint_po-0.1.5.tar.gz:

Publisher: build-and-publish.yml on himdel/lint-po

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: lint_po-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lint_po-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bc5b316104c2a61e54c5132e1ab2f20f9452886d69548719eb37d87570661806
MD5 72e9c473e6f907430f3196f47da19bf6
BLAKE2b-256 68209a3127fb08285c7a4fc7a8abf8910ea3cca6f926dab634f9f4f75f45e894

See more details on using hashes here.

Provenance

The following attestation bundles were made for lint_po-0.1.5-py3-none-any.whl:

Publisher: build-and-publish.yml on himdel/lint-po

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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