Skip to main content

A translation file finder used in Weblate.

Project description

Weblate

Weblate is a copylefted 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)
28
>>> 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[14].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[14].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.14.tar.gz (71.5 kB view details)

Uploaded Source

Built Distribution

translation_finder-2.14-py3-none-any.whl (83.7 kB view details)

Uploaded Python 3

File details

Details for the file translation-finder-2.14.tar.gz.

File metadata

  • Download URL: translation-finder-2.14.tar.gz
  • Upload date:
  • Size: 71.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for translation-finder-2.14.tar.gz
Algorithm Hash digest
SHA256 7d876811e3e6b0b04fc7f941fb5ad07f41ff5c15d9df2bea995e816bdf466198
MD5 9f69540c30ea897353af58e9e66cf931
BLAKE2b-256 93d1d3acf2380d90d56ba00c36557413f348c5f463b9a03efe7a441b4a3c4921

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for translation_finder-2.14-py3-none-any.whl
Algorithm Hash digest
SHA256 9fc80f9ceb9dc1df4dd47c2d6f97eb069a3d32499cb1dcaeddb59d5a3c4d13d4
MD5 8b6c9d70fa7b8b958e6d5b7a923621db
BLAKE2b-256 85c453055d478d5732f3aa1b1579b06eea5179d3d095a29d61fb46f0cb36fb9b

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