Skip to main content

A translation file finder used in Weblate.

Project description

Weblate

Weblate is libre software web-based continuous localization system, used by over 2500 libre projects and companies in more than 165 countries.

A translation file finder for Weblate, translation tool with tight version control integration.

Website Translation status CII Best Practices PyPI package Documentation

This library is used by Weblate to discover translation files in a cloned repository. It can operate on both file listings and actual filesystem. Filesystem access is needed for more accurate detection in some cases (detecting encoding or actual syntax of similar files).

Usage

In can be used from Python:

>>> from translation_finder import discover
>>> from pprint import pprint
>>> results = discover("translation_finder/test_data/")
>>> len(results)
40
>>> pprint(results[0].match)
{'file_format': 'aresource',
 'filemask': 'app/src/res/main/values-*/strings.xml',
 'name': 'android',
 'template': 'app/src/res/main/values/strings.xml'}
>>> pprint(results[1].match)
{'file_format': 'po',
 'filemask': 'locales/*.po',
 'name': 'translation',
 'new_base': 'locales/messages.pot'}

Additional information about discovery can be obtained from meta attribute:

>>> pprint(results[0].meta)
{'discovery': 'TransifexDiscovery', 'origin': 'Transifex', 'priority': 500}
>>> pprint(results[22].meta)
{'discovery': 'GettextDiscovery', 'origin': None, 'priority': 1000}

Or command line:

$ weblate-discovery translation_finder/test_data/
== Match 1 (Transifex) ==
file_format    : aresource
filemask       : app/src/res/main/values-*/strings.xml
name           : android
template       : app/src/res/main/values/strings.xml
...

== Match 7 ==
file_format    : po
filemask       : locales/*.po
new_base       : locales/messages.pot

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

translation_finder-2.24.tar.gz (80.9 kB view details)

Uploaded Source

Built Distribution

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

translation_finder-2.24-py3-none-any.whl (92.0 kB view details)

Uploaded Python 3

File details

Details for the file translation_finder-2.24.tar.gz.

File metadata

  • Download URL: translation_finder-2.24.tar.gz
  • Upload date:
  • Size: 80.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for translation_finder-2.24.tar.gz
Algorithm Hash digest
SHA256 13612ae1dc0697f3e92f608f592d466173f391a404e9a93116498d2d54f49175
MD5 2b57ee8841b564ac1d8fa3a4c3c86d86
BLAKE2b-256 28f0f6bb9c07d6e59ed4516e73213da63d1b5036585c708d2c436f36cd9728e6

See more details on using hashes here.

File details

Details for the file translation_finder-2.24-py3-none-any.whl.

File metadata

  • Download URL: translation_finder-2.24-py3-none-any.whl
  • Upload date:
  • Size: 92.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for translation_finder-2.24-py3-none-any.whl
Algorithm Hash digest
SHA256 038a3b71a8c4e8141e5130a4f67e6ec89b8a1420df1c012a7d10bedda94ffe74
MD5 d54f8bb90fc3458c1714a52e7fcb6f29
BLAKE2b-256 49f8873c4ad9b54780cc204013f6f7ef452599159edad9b2d99d61a503163269

See more details on using hashes here.

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