translation-finder


Nametranslation-finder JSON
Version 2.16 PyPI version JSON
download
home_pagehttps://weblate.org/
SummaryA translation file finder used in Weblate.
upload_time2023-12-20 12:24:24
maintainer
docs_urlNone
authorMichal Čihař
requires_python>=3.9
licenseGPL-3.0-or-later
keywords i18n l10n gettext translate
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. 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": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "i18n l10n gettext translate",
    "author": "Michal \u010ciha\u0159",
    "author_email": "michal@cihar.com",
    "download_url": "https://files.pythonhosted.org/packages/ff/2c/c10f0a18ea03ad40a385dfd21e5846d397bca2c7bd7aa1ada20348bb7b45/translation-finder-2.16.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.16",
    "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",
        "translate"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4597e1ef8e77cadb0a3f23d414d73f24b925efd65c86e1c731deb6386d488344",
                "md5": "83fbddc167e10ceeaf338ead0996b8d6",
                "sha256": "1846cb27e1980340a01d181000607c925f486dea40ed5fc6d97f71b8a97c917b"
            },
            "downloads": -1,
            "filename": "translation_finder-2.16-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "83fbddc167e10ceeaf338ead0996b8d6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 80285,
            "upload_time": "2023-12-20T12:24:23",
            "upload_time_iso_8601": "2023-12-20T12:24:23.593337Z",
            "url": "https://files.pythonhosted.org/packages/45/97/e1ef8e77cadb0a3f23d414d73f24b925efd65c86e1c731deb6386d488344/translation_finder-2.16-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ff2cc10f0a18ea03ad40a385dfd21e5846d397bca2c7bd7aa1ada20348bb7b45",
                "md5": "26b16efe55b49aa30f4c4df2e3187824",
                "sha256": "6b50be8f8668d0327d0560e7e59b2ee3301fb5c522c5f3e4b4059daa2149a625"
            },
            "downloads": -1,
            "filename": "translation-finder-2.16.tar.gz",
            "has_sig": false,
            "md5_digest": "26b16efe55b49aa30f4c4df2e3187824",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 71344,
            "upload_time": "2023-12-20T12:24:24",
            "upload_time_iso_8601": "2023-12-20T12:24:24.973747Z",
            "url": "https://files.pythonhosted.org/packages/ff/2c/c10f0a18ea03ad40a385dfd21e5846d397bca2c7bd7aa1ada20348bb7b45/translation-finder-2.16.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-20 12:24:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "WeblateOrg",
    "github_project": "translation-finder",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "translation-finder"
}
        
Elapsed time: 0.15817s