translation-finder-2.9
توضیحات
A translation file finder used in Weblate.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | translation-finder-2.9 |
| نام | translation-finder |
| نسخه کتابخانه | 2.9 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Michal Čihař |
| ایمیل نویسنده | Michal Čihař <michal@weblate.org> |
| آدرس صفحه اصلی | https://weblate.org/ |
| آدرس اینترنتی | https://pypi.org/project/translation-finder/ |
| مجوز | - |
.. image:: https://s.weblate.org/cdn/Logo-Darktext-borders.png
:alt: Weblate
:target: https://weblate.org/
:height: 80px
**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.
.. image:: https://img.shields.io/badge/website-weblate.org-blue.svg
:alt: Website
:target: https://weblate.org/
.. image:: https://hosted.weblate.org/widgets/weblate/-/svg-badge.svg
:alt: Translation status
:target: https://hosted.weblate.org/engage/weblate/?utm_source=widget
.. image:: https://bestpractices.coreinfrastructure.org/projects/552/badge
:alt: CII Best Practices
:target: https://bestpractices.coreinfrastructure.org/projects/552
.. image:: https://img.shields.io/pypi/v/translation-finder.svg
:target: https://pypi.org/project/translation-finder/
:alt: PyPI package
.. image:: https://readthedocs.org/projects/weblate/badge/
:alt: Documentation
:target: https://docs.weblate.org/
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:
.. code-block:: pycon
>>> from translation_finder import discover
>>> from pprint import pprint
>>> results = discover("translation_finder/test_data/")
>>> len(results)
40
>>> 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[1].match)
{'file_format': 'po',
'filemask': 'locales/*.po',
'name': 'translation',
'new_base': 'locales/messages.pot'}
Additional information about discovery can be obtained from meta attribute:
.. code-block:: pycon
>>> pprint(results[0].meta)
{'discovery': 'TransifexDiscovery', 'origin': 'Transifex', 'priority': 500}
>>> pprint(results[22].meta)
{'discovery': 'GettextDiscovery', 'origin': None, 'priority': 1000}
Or command line:
.. code-block:: console
$ 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
.. _Weblate: https://weblate.org/
نیازمندی
| مقدار | نام |
|---|---|
| - | charset-normalizer<4.0,>2.0 |
| - | ruamel.yaml |
| - | weblate-language-data>=2026.1 |
| xtr | translation-finder[lint,test,types]; |
| xtr | pre-commit==4.5.1; |
| xtr | pytest==9.0.2; |
| xtr | pytest-cov==7.0.0; |
| xtr | pytest-github-actions-annotate-failures==0.3.0; |
| xtr | mypy==1.19.1; |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.11 | Python |
نحوه نصب
نصب پکیج whl translation-finder-2.9:
pip install translation-finder-2.9.whl
نصب پکیج tar.gz translation-finder-2.9:
pip install translation-finder-2.9.tar.gz