Skip to main content

A translation file finder used in Weblate.

Project description

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

Build Status Code coverage PyPI package

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)
21
>>> 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[10].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[10].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-1.8.tar.gz (33.8 kB view details)

Uploaded Source

Built Distribution

translation_finder-1.8-py2.py3-none-any.whl (38.2 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: translation-finder-1.8.tar.gz
  • Upload date:
  • Size: 33.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

File hashes

Hashes for translation-finder-1.8.tar.gz
Algorithm Hash digest
SHA256 5d3b2ebc525e4f7b44c0f869af18f910e2c2daff6ab006694deda1ea055ee9b1
MD5 2e94ef7f19a8b133a22f038842b18366
BLAKE2b-256 412df8ea33176fc0ec0f72d31bb1be4fa99edc3b0560ab3083c9f4973b34cd31

See more details on using hashes here.

File details

Details for the file translation_finder-1.8-py2.py3-none-any.whl.

File metadata

  • Download URL: translation_finder-1.8-py2.py3-none-any.whl
  • Upload date:
  • Size: 38.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

File hashes

Hashes for translation_finder-1.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3d8d7fe0b1e204b5e0dfc74e0a80ed9ea2561d46fd6fb36f4e10cd22dc5aa96c
MD5 f213b2653168ca07f84547f7f97c0987
BLAKE2b-256 1f8cf1774949117db377b0d587444ffce6013a27857fe7f1f0ec381e6594d043

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