traduki


Nametraduki JSON
Version 1.3.3 PyPI version JSON
download
home_pagehttps://github.com/paylogic/traduki
SummarySQLAlchemy internationalisation
upload_time2024-10-17 13:58:58
maintainerNone
docs_urlNone
authorPaylogic International
requires_pythonNone
licenseMIT
keywords sqlalchemy i18n internationalisation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            traduki: SQLAlchemy internationalisation
========================================

The ``traduki`` package provides internationalisation helper classes for SQLAlchemy-based projects.

.. image:: https://api.travis-ci.org/paylogic/traduki.png
   :target: https://travis-ci.org/paylogic/traduki
.. image:: https://img.shields.io/pypi/v/traduki.svg
   :target: https://crate.io/packages/traduki/
.. image:: https://coveralls.io/repos/paylogic/traduki/badge.png?branch=master
   :target: https://coveralls.io/r/paylogic/traduki


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

.. sourcecode::

    pip install traduki


Usage
-----

traduki usage example:

.. code-block:: python

    from sqlalchemy.ext.declarative import declarative_base

    Base = declarative_base()

    import traduki

    def get_current_language():
        """Current language callback for our project."""
        return request.locale

    def get_language_chain():
        """Language chain (fallback rule) callback for our project."""
        return {'*': request.locale}

    i18n_attributes = traduki.initialize(Base, ['en', 'ru'], get_current_language, get_language_chain)

    Session = sessionmaker(bind=engine)
    sess = Session()

    class MyModel(Base)

        title_id = i18n_attributes.i18n_column(nullable=False, unique=False)
        title = i18n_attributes.i18n_relation(title_id)
        """Title."""

    my_object = MyModel()
    my_object.title = {'en': 'English title', 'pt': 'Portugese title'}
    sess.add(my_object)
    sess.commit()

    assert sess.refresh(my_object).title.get_dict() == {'en': 'English title', 'pt': 'Portugese title'}


Contact
-------

If you have questions, bug reports, suggestions, etc. please create an issue on
the `GitHub project page <http://github.com/paylogic/traduki>`_.


License
-------

This software is licensed under the `MIT license <http://en.wikipedia.org/wiki/MIT_License>`_

See `License <https://github.com/paylogic/traduki/blob/master/LICENSE.txt>`_


© 2018 Paylogic International.

Changelog
=========

1.3.3
-----
* Fix sqlalchemy 2.0 compatibility warning by using `sqlalchemy.orm.Mapper` instead of `sqlalchemy.orm.mapper`.

1.3.2
-----
* Fix a bug where the `get_ordered_languages` would mutate in place the list of configured languages.

1.3.1
-----
* Fix UnicodeDecodeError when installing this library on python 3 on some configurations.

1.3.0
-----

* Fix python 3 compatibility
* Declare support for python 2.7, 3.5, 3.6, 3.7, 3.8

1.2.0
-----

* Do not use deprecated AttributeExtension, use Attribute Events instead.

1.1.0
-----

* Use an OR operator for LIKE_OPS to find matches in all language columns.

1.0.1
-----

* Fix `get_text_from_dict` raising an exception when no language can be detected.

1.0.0
-----

* Initial public release



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/paylogic/traduki",
    "name": "traduki",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "sqlalchemy i18n internationalisation",
    "author": "Paylogic International",
    "author_email": "developers@paylogic.com",
    "download_url": "https://files.pythonhosted.org/packages/af/0f/8b0cf6d9b67e789bfab7a0e38e6a86a7910011f692cb0dbfef9fbcba81d6/traduki-1.3.3.tar.gz",
    "platform": null,
    "description": "traduki: SQLAlchemy internationalisation\n========================================\n\nThe ``traduki`` package provides internationalisation helper classes for SQLAlchemy-based projects.\n\n.. image:: https://api.travis-ci.org/paylogic/traduki.png\n   :target: https://travis-ci.org/paylogic/traduki\n.. image:: https://img.shields.io/pypi/v/traduki.svg\n   :target: https://crate.io/packages/traduki/\n.. image:: https://coveralls.io/repos/paylogic/traduki/badge.png?branch=master\n   :target: https://coveralls.io/r/paylogic/traduki\n\n\nInstallation\n------------\n\n.. sourcecode::\n\n    pip install traduki\n\n\nUsage\n-----\n\ntraduki usage example:\n\n.. code-block:: python\n\n    from sqlalchemy.ext.declarative import declarative_base\n\n    Base = declarative_base()\n\n    import traduki\n\n    def get_current_language():\n        \"\"\"Current language callback for our project.\"\"\"\n        return request.locale\n\n    def get_language_chain():\n        \"\"\"Language chain (fallback rule) callback for our project.\"\"\"\n        return {'*': request.locale}\n\n    i18n_attributes = traduki.initialize(Base, ['en', 'ru'], get_current_language, get_language_chain)\n\n    Session = sessionmaker(bind=engine)\n    sess = Session()\n\n    class MyModel(Base)\n\n        title_id = i18n_attributes.i18n_column(nullable=False, unique=False)\n        title = i18n_attributes.i18n_relation(title_id)\n        \"\"\"Title.\"\"\"\n\n    my_object = MyModel()\n    my_object.title = {'en': 'English title', 'pt': 'Portugese title'}\n    sess.add(my_object)\n    sess.commit()\n\n    assert sess.refresh(my_object).title.get_dict() == {'en': 'English title', 'pt': 'Portugese title'}\n\n\nContact\n-------\n\nIf you have questions, bug reports, suggestions, etc. please create an issue on\nthe `GitHub project page <http://github.com/paylogic/traduki>`_.\n\n\nLicense\n-------\n\nThis software is licensed under the `MIT license <http://en.wikipedia.org/wiki/MIT_License>`_\n\nSee `License <https://github.com/paylogic/traduki/blob/master/LICENSE.txt>`_\n\n\n\u00a9 2018 Paylogic International.\n\nChangelog\n=========\n\n1.3.3\n-----\n* Fix sqlalchemy 2.0 compatibility warning by using `sqlalchemy.orm.Mapper` instead of `sqlalchemy.orm.mapper`.\n\n1.3.2\n-----\n* Fix a bug where the `get_ordered_languages` would mutate in place the list of configured languages.\n\n1.3.1\n-----\n* Fix UnicodeDecodeError when installing this library on python 3 on some configurations.\n\n1.3.0\n-----\n\n* Fix python 3 compatibility\n* Declare support for python 2.7, 3.5, 3.6, 3.7, 3.8\n\n1.2.0\n-----\n\n* Do not use deprecated AttributeExtension, use Attribute Events instead.\n\n1.1.0\n-----\n\n* Use an OR operator for LIKE_OPS to find matches in all language columns.\n\n1.0.1\n-----\n\n* Fix `get_text_from_dict` raising an exception when no language can be detected.\n\n1.0.0\n-----\n\n* Initial public release\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "SQLAlchemy internationalisation",
    "version": "1.3.3",
    "project_urls": {
        "Homepage": "https://github.com/paylogic/traduki"
    },
    "split_keywords": [
        "sqlalchemy",
        "i18n",
        "internationalisation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "53c77211917638872a90f7e642916a105a8db0638beb00d34a88e6ec7a1edd6e",
                "md5": "23201775cd10d1d2421586b345cc039a",
                "sha256": "627500e4a24517b02ef6e4e4874c4f5616c1eda31a5b3cb60e1df0a2ca2222c5"
            },
            "downloads": -1,
            "filename": "traduki-1.3.3-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "23201775cd10d1d2421586b345cc039a",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 8120,
            "upload_time": "2024-10-17T13:58:56",
            "upload_time_iso_8601": "2024-10-17T13:58:56.915597Z",
            "url": "https://files.pythonhosted.org/packages/53/c7/7211917638872a90f7e642916a105a8db0638beb00d34a88e6ec7a1edd6e/traduki-1.3.3-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "af0f8b0cf6d9b67e789bfab7a0e38e6a86a7910011f692cb0dbfef9fbcba81d6",
                "md5": "c903d782f774f512f997957d4adbbdfb",
                "sha256": "25937b30d78e6a68e0065215e3742da1d6a9e454cc19e9382d33871fbbf81057"
            },
            "downloads": -1,
            "filename": "traduki-1.3.3.tar.gz",
            "has_sig": false,
            "md5_digest": "c903d782f774f512f997957d4adbbdfb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7915,
            "upload_time": "2024-10-17T13:58:58",
            "upload_time_iso_8601": "2024-10-17T13:58:58.525855Z",
            "url": "https://files.pythonhosted.org/packages/af/0f/8b0cf6d9b67e789bfab7a0e38e6a86a7910011f692cb0dbfef9fbcba81d6/traduki-1.3.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-17 13:58:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "paylogic",
    "github_project": "traduki",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "traduki"
}
        
Elapsed time: 0.40478s