A translation file finder used in Weblate.
Project description
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.
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)
22
>>> 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[11].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[11].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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for translation_finder-2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4137303b0e3b7f531487befffff1ef09727960164259ced4fe4d0c4fb28a2f9 |
|
MD5 | a11feb64db30464aef48b8a0b0366da4 |
|
BLAKE2b-256 | b52d19bf4763e8cdf48a6938ccfbaa501a23753192d25dd5c1dfff2809433428 |