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)
13
>>> 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[5].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[5].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.5.tar.gz (31.3 kB view details)

Uploaded Source

Built Distribution

translation_finder-1.5-py2.py3-none-any.whl (37.3 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: translation-finder-1.5.tar.gz
  • Upload date:
  • Size: 31.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3

File hashes

Hashes for translation-finder-1.5.tar.gz
Algorithm Hash digest
SHA256 9ea83d0870e3f0b5da4f7fe33f2d82e8f00868001a85a4248143cbcb0ec9ceaf
MD5 757b621b6eba4012dae5a46962ec1423
BLAKE2b-256 7bfc7f9fbc7ed02b3b5923614fa53b0acafced76f4d5768c132463551ec935c2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: translation_finder-1.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 37.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3

File hashes

Hashes for translation_finder-1.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f90214b1d55711891f4ab8bd341ef82ebbec65b43a451133c0b5f43aad9e048d
MD5 07abdbb7851ab91f8572107f70db5498
BLAKE2b-256 558f2d50a5076a99dc0ad24fca1dee2ce14491d85cbe6db67862dbd2643f4ba8

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