pytest-translations


Namepytest-translations JSON
Version 5.0.0 PyPI version JSON
download
home_pagehttps://github.com/Thermondo/pytest-translations
SummaryTest your translation files.
upload_time2023-09-11 09:55:22
maintainer
docs_urlNone
authorthermondo
requires_python>=3.8,<4.0
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            |version| |ci| |coverage| |license|

PyTest Translations
===================

A py.test plugin to check ``gettext`` ``po`` & ``mo`` files.

Test check for:

-  Spelling (using enchant & aspell)
-  Consistency of ``mo`` files
-  Obsolete translations
-  Fuzzy translations

Installation
------------

Install the PyPi package.

.. code:: bash

    pip install pytest-translations

The spell checking requires enchant and aspell including the correct
dictionary.

On Linux simply install:

.. code:: bash

    sudo apt-get install python3-enchant python-enchant aspell-{en|de|CHOSE YOUR LANGUAGE CODES}

To set up travis-ci simply add the apt packages to your travis-ci config
YAML:

.. code:: yaml

    addons:
      apt:
        packages:
        - python-enchant
        - python3-enchant
        - aspell-en
        - aspell-de

On Mac you can use brew to install:

.. code:: bash

    brew install aspell
    brew install enchant

Usage
-----

To execute the translation tests simply run

.. code:: bash

    py.test --translations

Every file ending in ``.mo`` and ``.po`` will be discovered and tested,
starting from the command line arguments.

You also can execute only the translation-tests by using:

.. code:: bash

    py.test -m translations --translations

Private Word Lists
~~~~~~~~~~~~~~~~~~

You will almost certainly use words that are not included in the default
dictionaries. That is why you can add your own word list that you want
to add to the dictionary.

You may do so by adding a plain text file where each line is a word.
Words beginning with a capital letter are case sensitive where lower case words
are insensitive.

There can be one file for each language contained in a single folder.
The files should be named like the proper language code.

For example:

.. code:: bash

    .
    └── .spelling
        ├── de
        ├── en_GB
        └── en_US

What’s left to do is to set an environment variable to point to right
directory.

For example:

.. code:: bash

    export PYTEST_TRANSLATIONS_PRIVATE_WORD_LIST=path/to/my/.spelling

.. |version| image:: https://img.shields.io/pypi/v/pytest-translations.svg
   :target: https://pypi.python.org/pypi/pytest-translations/
.. |ci| image:: https://github.com/Thermondo/pytest-translations/actions/workflows/ci.yml/badge.svg
   :target: https://github.com/Thermondo/pytest-translations/actions/workflows/ci.yml
.. |coverage| image:: https://codecov.io/gh/Thermondo/pytest-translations/branch/master/graph/badge.svg
   :target: https://codecov.io/gh/Thermondo/pytest-translations
.. |license| image:: https://img.shields.io/badge/license-APL_2-blue.svg
   :target: LICENSE


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Thermondo/pytest-translations",
    "name": "pytest-translations",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "thermondo",
    "author_email": "opensource@thermondo.de",
    "download_url": "https://files.pythonhosted.org/packages/7b/44/aa0e2b9046deead9d267a67a6a1e1a392d8ef89e86f3820275c530bf0cdb/pytest_translations-5.0.0.tar.gz",
    "platform": null,
    "description": "|version| |ci| |coverage| |license|\n\nPyTest Translations\n===================\n\nA py.test plugin to check ``gettext`` ``po`` & ``mo`` files.\n\nTest check for:\n\n-  Spelling (using enchant & aspell)\n-  Consistency of ``mo`` files\n-  Obsolete translations\n-  Fuzzy translations\n\nInstallation\n------------\n\nInstall the PyPi package.\n\n.. code:: bash\n\n    pip install pytest-translations\n\nThe spell checking requires enchant and aspell including the correct\ndictionary.\n\nOn Linux simply install:\n\n.. code:: bash\n\n    sudo apt-get install python3-enchant python-enchant aspell-{en|de|CHOSE YOUR LANGUAGE CODES}\n\nTo set up travis-ci simply add the apt packages to your travis-ci config\nYAML:\n\n.. code:: yaml\n\n    addons:\n      apt:\n        packages:\n        - python-enchant\n        - python3-enchant\n        - aspell-en\n        - aspell-de\n\nOn Mac you can use brew to install:\n\n.. code:: bash\n\n    brew install aspell\n    brew install enchant\n\nUsage\n-----\n\nTo execute the translation tests simply run\n\n.. code:: bash\n\n    py.test --translations\n\nEvery file ending in ``.mo`` and ``.po`` will be discovered and tested,\nstarting from the command line arguments.\n\nYou also can execute only the translation-tests by using:\n\n.. code:: bash\n\n    py.test -m translations --translations\n\nPrivate Word Lists\n~~~~~~~~~~~~~~~~~~\n\nYou will almost certainly use words that are not included in the default\ndictionaries. That is why you can add your own word list that you want\nto add to the dictionary.\n\nYou may do so by adding a plain text file where each line is a word.\nWords beginning with a capital letter are case sensitive where lower case words\nare insensitive.\n\nThere can be one file for each language contained in a single folder.\nThe files should be named like the proper language code.\n\nFor example:\n\n.. code:: bash\n\n    .\n    \u2514\u2500\u2500 .spelling\n        \u251c\u2500\u2500 de\n        \u251c\u2500\u2500 en_GB\n        \u2514\u2500\u2500 en_US\n\nWhat\u2019s left to do is to set an environment variable to point to right\ndirectory.\n\nFor example:\n\n.. code:: bash\n\n    export PYTEST_TRANSLATIONS_PRIVATE_WORD_LIST=path/to/my/.spelling\n\n.. |version| image:: https://img.shields.io/pypi/v/pytest-translations.svg\n   :target: https://pypi.python.org/pypi/pytest-translations/\n.. |ci| image:: https://github.com/Thermondo/pytest-translations/actions/workflows/ci.yml/badge.svg\n   :target: https://github.com/Thermondo/pytest-translations/actions/workflows/ci.yml\n.. |coverage| image:: https://codecov.io/gh/Thermondo/pytest-translations/branch/master/graph/badge.svg\n   :target: https://codecov.io/gh/Thermondo/pytest-translations\n.. |license| image:: https://img.shields.io/badge/license-APL_2-blue.svg\n   :target: LICENSE\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Test your translation files.",
    "version": "5.0.0",
    "project_urls": {
        "Homepage": "https://github.com/Thermondo/pytest-translations",
        "Repository": "https://github.com/Thermondo/pytest-translations"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dfcd28bdeccc0a1a129864b726494f36c9b87ec6a8dadeb90ef9f9ee2114bd9b",
                "md5": "c4d889e94386fbad01556740e54e5590",
                "sha256": "9fd20a99591714b656281b674e0186a9df485a7d2aedccde2453b5a465f14eec"
            },
            "downloads": -1,
            "filename": "pytest_translations-5.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c4d889e94386fbad01556740e54e5590",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 7537,
            "upload_time": "2023-09-11T09:55:20",
            "upload_time_iso_8601": "2023-09-11T09:55:20.653136Z",
            "url": "https://files.pythonhosted.org/packages/df/cd/28bdeccc0a1a129864b726494f36c9b87ec6a8dadeb90ef9f9ee2114bd9b/pytest_translations-5.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7b44aa0e2b9046deead9d267a67a6a1e1a392d8ef89e86f3820275c530bf0cdb",
                "md5": "955d4020df5d140a8f20ab2a963dad49",
                "sha256": "ffd84082f9363350a51a3757a73352a1aadfffd14e7af872df2decc7dfbf4a0e"
            },
            "downloads": -1,
            "filename": "pytest_translations-5.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "955d4020df5d140a8f20ab2a963dad49",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 5358,
            "upload_time": "2023-09-11T09:55:22",
            "upload_time_iso_8601": "2023-09-11T09:55:22.221534Z",
            "url": "https://files.pythonhosted.org/packages/7b/44/aa0e2b9046deead9d267a67a6a1e1a392d8ef89e86f3820275c530bf0cdb/pytest_translations-5.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-11 09:55:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Thermondo",
    "github_project": "pytest-translations",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pytest-translations"
}
        
Elapsed time: 2.52056s