A translation file finder used in Weblate.
Project description
Weblate is 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.
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)
30
>>> 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[16].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[16].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
File details
Details for the file translation_finder-2.18.tar.gz
.
File metadata
- Download URL: translation_finder-2.18.tar.gz
- Upload date:
- Size: 74.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.5.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f769a58ebbfd566e3ad872d65c4072858e35989160fd45e7d692b81fd8bbb65b |
|
MD5 | dd029c6ab8318303063544ccd64ba62a |
|
BLAKE2b-256 | 281d67cbcbd097b51c5e3bc0ba7fcc78b8c36d244ed128103f3f220db72c34f4 |
File details
Details for the file translation_finder-2.18-py3-none-any.whl
.
File metadata
- Download URL: translation_finder-2.18-py3-none-any.whl
- Upload date:
- Size: 82.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.5.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcc61b1af5b672e0ab05efe53b76ed6a390240b94996cad09a1c55044af1a27f |
|
MD5 | d8ccdd1beaa67b8c0e103c2f4270231a |
|
BLAKE2b-256 | a8b2636767e2ee8d1cb1c99cdec072fac1f6d676df1f25980f8590b1b4f23b9e |