.. 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)
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:
.. code-block:: pycon
>>> pprint(results[0].meta)
{'discovery': 'TransifexDiscovery', 'origin': 'Transifex', 'priority': 500}
>>> pprint(results[16].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/
Raw data
{
"_id": null,
"home_page": "https://weblate.org/",
"name": "translation-finder",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "i18n, l10n, gettext, weblate, translate",
"author": "Michal \u010ciha\u0159",
"author_email": "Michal \u010ciha\u0159 <michal@cihar.com>",
"download_url": "https://files.pythonhosted.org/packages/a9/c7/9dec2f3ad7e1ea7b61e34e450837ab6c1796bb6c4cec3ba1c2ffb27ede51/translation_finder-2.19.tar.gz",
"platform": "any",
"description": ".. image:: https://s.weblate.org/cdn/Logo-Darktext-borders.png\n :alt: Weblate\n :target: https://weblate.org/\n :height: 80px\n\n**Weblate is libre software web-based continuous localization system,\nused by over 2500 libre projects and companies in more than 165 countries.**\n\nA translation file finder for `Weblate`_, translation tool with tight version\ncontrol integration.\n\n.. image:: https://img.shields.io/badge/website-weblate.org-blue.svg\n :alt: Website\n :target: https://weblate.org/\n\n.. image:: https://hosted.weblate.org/widgets/weblate/-/svg-badge.svg\n :alt: Translation status\n :target: https://hosted.weblate.org/engage/weblate/?utm_source=widget\n\n.. image:: https://bestpractices.coreinfrastructure.org/projects/552/badge\n :alt: CII Best Practices\n :target: https://bestpractices.coreinfrastructure.org/projects/552\n\n.. image:: https://img.shields.io/pypi/v/translation-finder.svg\n :target: https://pypi.org/project/translation-finder/\n :alt: PyPI package\n\n.. image:: https://readthedocs.org/projects/weblate/badge/\n :alt: Documentation\n :target: https://docs.weblate.org/\n\nThis library is used by `Weblate`_ to discover translation files in a cloned\nrepository. It can operate on both file listings and actual filesystem.\nFilesystem access is needed for more accurate detection in some cases\n(detecting encoding or actual syntax of similar files).\n\nUsage\n-----\n\nIn can be used from Python:\n\n.. code-block:: pycon\n\n >>> from translation_finder import discover\n >>> from pprint import pprint\n >>> results = discover(\"translation_finder/test_data/\")\n >>> len(results)\n 30\n >>> pprint(results[0].match)\n {'file_format': 'aresource',\n 'filemask': 'app/src/res/main/values-*/strings.xml',\n 'name': 'android',\n 'template': 'app/src/res/main/values/strings.xml'}\n >>> pprint(results[16].match)\n {'file_format': 'po',\n 'filemask': 'locales/*.po',\n 'new_base': 'locales/messages.pot'}\n\nAdditional information about discovery can be obtained from meta attribute:\n\n.. code-block:: pycon\n\n >>> pprint(results[0].meta)\n {'discovery': 'TransifexDiscovery', 'origin': 'Transifex', 'priority': 500}\n >>> pprint(results[16].meta)\n {'discovery': 'GettextDiscovery', 'origin': None, 'priority': 1000}\n\n\nOr command line:\n\n.. code-block:: console\n\n $ weblate-discovery translation_finder/test_data/\n == Match 1 (Transifex) ==\n file_format : aresource\n filemask : app/src/res/main/values-*/strings.xml\n name : android\n template : app/src/res/main/values/strings.xml\n ...\n\n == Match 7 ==\n file_format : po\n filemask : locales/*.po\n new_base : locales/messages.pot\n\n.. _Weblate: https://weblate.org/\n",
"bugtrack_url": null,
"license": "GPL-3.0-or-later",
"summary": "A translation file finder used in Weblate.",
"version": "2.19",
"project_urls": {
"Documentation": "https://docs.weblate.org/",
"Download": "https://github.com/WeblateOrg/translation-finder",
"Funding": "https://weblate.org/donate/",
"Homepage": "https://weblate.org/",
"Issue Tracker": "https://github.com/WeblateOrg/translation-finder/issues",
"Source Code": "https://github.com/WeblateOrg/translation-finder",
"Twitter": "https://twitter.com/WeblateOrg"
},
"split_keywords": [
"i18n",
" l10n",
" gettext",
" weblate",
" translate"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "53da235d6410f7459ba962f960fba91f3b3536c7b1f20ca45b3e87640ea965eb",
"md5": "82f873fc77cce48807e04d16b0a9f500",
"sha256": "66b7183b0bd15e3cba262678ee11a4280aa26b615f41d7bcf1b8e1eb654a1f86"
},
"downloads": -1,
"filename": "translation_finder-2.19-py3-none-any.whl",
"has_sig": false,
"md5_digest": "82f873fc77cce48807e04d16b0a9f500",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 82634,
"upload_time": "2024-11-18T08:13:18",
"upload_time_iso_8601": "2024-11-18T08:13:18.355067Z",
"url": "https://files.pythonhosted.org/packages/53/da/235d6410f7459ba962f960fba91f3b3536c7b1f20ca45b3e87640ea965eb/translation_finder-2.19-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a9c79dec2f3ad7e1ea7b61e34e450837ab6c1796bb6c4cec3ba1c2ffb27ede51",
"md5": "9c2e3691b715f2cf6866d6d99550c933",
"sha256": "e1e4cfa88d9504a779102264e669a0aca39a2302c23619b00b1fa3bfc1be9702"
},
"downloads": -1,
"filename": "translation_finder-2.19.tar.gz",
"has_sig": false,
"md5_digest": "9c2e3691b715f2cf6866d6d99550c933",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 74316,
"upload_time": "2024-11-18T08:13:20",
"upload_time_iso_8601": "2024-11-18T08:13:20.100424Z",
"url": "https://files.pythonhosted.org/packages/a9/c7/9dec2f3ad7e1ea7b61e34e450837ab6c1796bb6c4cec3ba1c2ffb27ede51/translation_finder-2.19.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-18 08:13:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "WeblateOrg",
"github_project": "translation-finder",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "translation-finder"
}