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)
30
>>> 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[16].match)
{'file_format': 'po',
 'filemask': 'locales/*.po',
 '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[16].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.19.tar.gz (74.3 kB view details)

Uploaded Source

Built Distribution

translation_finder-2.19-py3-none-any.whl (82.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: translation_finder-2.19.tar.gz
  • Upload date:
  • Size: 74.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.5.2

File hashes

Hashes for translation_finder-2.19.tar.gz
Algorithm Hash digest
SHA256 e1e4cfa88d9504a779102264e669a0aca39a2302c23619b00b1fa3bfc1be9702
MD5 9c2e3691b715f2cf6866d6d99550c933
BLAKE2b-256 a9c79dec2f3ad7e1ea7b61e34e450837ab6c1796bb6c4cec3ba1c2ffb27ede51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for translation_finder-2.19-py3-none-any.whl
Algorithm Hash digest
SHA256 66b7183b0bd15e3cba262678ee11a4280aa26b615f41d7bcf1b8e1eb654a1f86
MD5 82f873fc77cce48807e04d16b0a9f500
BLAKE2b-256 53da235d6410f7459ba962f960fba91f3b3536c7b1f20ca45b3e87640ea965eb

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