Usage
=====
1. Place your translation files in the directory tree structured as below:
.. code-block:: console
i18n/en_GB/messages.po
i18n/fr_FR/messages.po
2. Load the translation strings:
.. code-block:: python
from translations import init_translations
dir_path = os.path.dirname(os.path.realpath(__file__))
init_translations(dir_path + "/i18n")
3. Get translation string:
.. code-block:: python
from translations import translate
translate("de_DE", "Hello, %user%", {"user": "Alexey"}) # Prints "Hello, Alexey"
New version release
--------------------
To release new version:
1. Update sphinx_integral_theme/__init__.py with new __version__ and __version_info__
2. Run the following command:
.. code-block:: console
(.venv) $ flit publish
Raw data
{
"_id": null,
"home_page": null,
"name": "python-gettext-translations",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "translations, i18n, i18n_mrg",
"author": null,
"author_email": "Alexey Zauzin <a.zauzin@thestage.ai>",
"download_url": "https://files.pythonhosted.org/packages/01/c0/3e881d7b44282a8db0d191e2c6dd08ca8370a381dd763e507e3cd5907066/python_gettext_translations-1.1.0.tar.gz",
"platform": null,
"description": "Usage\n=====\n1. Place your translation files in the directory tree structured as below:\n.. code-block:: console\n\n i18n/en_GB/messages.po\n i18n/fr_FR/messages.po\n\n2. Load the translation strings:\n.. code-block:: python\n\n from translations import init_translations\n dir_path = os.path.dirname(os.path.realpath(__file__))\n init_translations(dir_path + \"/i18n\")\n\n3. Get translation string:\n.. code-block:: python\n\n from translations import translate\n translate(\"de_DE\", \"Hello, %user%\", {\"user\": \"Alexey\"}) # Prints \"Hello, Alexey\"\n\nNew version release\n--------------------\n\nTo release new version:\n1. Update sphinx_integral_theme/__init__.py with new __version__ and __version_info__\n2. Run the following command:\n.. code-block:: console\n\n (.venv) $ flit publish",
"bugtrack_url": null,
"license": null,
"summary": "Python gettext translations",
"version": "1.1.0",
"project_urls": null,
"split_keywords": [
"translations",
" i18n",
" i18n_mrg"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "ab46142f18b38cbde7c66c53993064bd3b6b3c0e759fe5ffabdc92602f5c6af3",
"md5": "fbab6436f425ffac3b98c6f62886d5a7",
"sha256": "2533ffac05bd13143a7a9d3352fc93ce1b46b949ed95a5e74e4d579208cf4185"
},
"downloads": -1,
"filename": "python_gettext_translations-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fbab6436f425ffac3b98c6f62886d5a7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 2763,
"upload_time": "2024-04-02T16:37:24",
"upload_time_iso_8601": "2024-04-02T16:37:24.665342Z",
"url": "https://files.pythonhosted.org/packages/ab/46/142f18b38cbde7c66c53993064bd3b6b3c0e759fe5ffabdc92602f5c6af3/python_gettext_translations-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "01c03e881d7b44282a8db0d191e2c6dd08ca8370a381dd763e507e3cd5907066",
"md5": "0c8bae946ea7855ba3c1df6e8dd9bd39",
"sha256": "d54ba5a380e916411e454254f59e232e42e63a43f88c5b6329e196a185dd08fb"
},
"downloads": -1,
"filename": "python_gettext_translations-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "0c8bae946ea7855ba3c1df6e8dd9bd39",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 2689,
"upload_time": "2024-04-02T16:37:26",
"upload_time_iso_8601": "2024-04-02T16:37:26.327249Z",
"url": "https://files.pythonhosted.org/packages/01/c0/3e881d7b44282a8db0d191e2c6dd08ca8370a381dd763e507e3cd5907066/python_gettext_translations-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-02 16:37:26",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "python-gettext-translations"
}