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 1150 libre projects and companies in more than 115 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)
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-2.1.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

translation_finder-2.1-py3-none-any.whl (38.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: translation-finder-2.1.tar.gz
  • Upload date:
  • Size: 35.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for translation-finder-2.1.tar.gz
Algorithm Hash digest
SHA256 a83fa838de0d86e7b22a0cfb550b680cd5282af56fd8c79eeb9189f64efd2f46
MD5 646c20124790dcb93db9be02b4797845
BLAKE2b-256 3ffbbea9390769eb8fbcc5bc74d7fe72311e058d738567e7befc6ed8b0677a06

See more details on using hashes here.

File details

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

File metadata

  • Download URL: translation_finder-2.1-py3-none-any.whl
  • Upload date:
  • Size: 38.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for translation_finder-2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 87ca6c9165894ed670762343772675080ec4e5d4edc2cd365f07d4be1623d423
MD5 99347594cee5251bfd9cb9d9b6a718fc
BLAKE2b-256 36ab7584d7ce4da945faa2a425d654c8e6b4c7d5dd1b9e389343fe6dbde20061

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