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-3.1.tar.gz (89.7 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-3.1-py3-none-any.whl (100.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: translation_finder-3.1.tar.gz
  • Upload date:
  • Size: 89.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","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-3.1.tar.gz
Algorithm Hash digest
SHA256 06784555f6d07ff0d8d399e198f3d342c89af26fab96387d492e33534f659d75
MD5 b4fc386296924f83ddc7daf6c3a66f82
BLAKE2b-256 47baa0969d7dc36bf29de6bd92ff13c928a9c8e28ae89a1d188c3038469c31c3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: translation_finder-3.1-py3-none-any.whl
  • Upload date:
  • Size: 100.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","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-3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7abc72b1a37fc84db827999206e400bbc2a9ce096382fbf20245a0652b491a9c
MD5 5eec19159a9ee2ddd1365418f9b11f44
BLAKE2b-256 54b2a2c9b0da0b19c942a4b7d2a8b0e7f4a09cc7bc41d129d72ef4633c511f8c

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