i21y


Namei21y JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryThe simple library for i18n support.
upload_time2024-10-13 04:26:45
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseMIT License Copyright (c) 2023 Takagi Tasuku Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords i18n
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI](https://img.shields.io/pypi/v/i21y)](https://pypi.org/project/i21y/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/i21y)
![PyPI - Downloads](https://img.shields.io/pypi/dm/i21y)
![PyPI - License](https://img.shields.io/pypi/l/i21y)
[![Documentation Status](https://readthedocs.org/projects/i21y/badge/?version=latest)](https://i21y.readthedocs.io/en/latest/?badge=latest)
[![Buy Me a Coffee](https://img.shields.io/badge/-tasuren-E9EEF3?label=Buy%20Me%20a%20Coffee&logo=buymeacoffee)](https://www.buymeacoffee.com/tasuren)

# i21y
i21y (a.k.a internationalization.py) is library for support i18n in Python. It is easy to use.

**Features:**
- Zero dependencies by default
- Simple design
- Utilities to simplify keys

## Installation
Normal: `pip install i21y`  
YAML support: `pip install i21y[yaml]`  
Fast JSON (by orjson) support: `pip install i21y[fast-json]`

## Example
### Basic
```python
from i21y import Translator
from i21y.loaders.json import Loader

t = Translator(Loader("locale"))

assert t("main.responses.not_found", locale="ja") == "見つからなかった。"
```
### Advanced
```python
from i21y import locale_str

LONG_KEY = locale_str("very.long.locale.key.yeah_so_long")
print(LONG_KEY.but_easy_to_use) # very.long.locale.key.yeah_so_long.but_easy_to_use

assert t(LONG_KEY.but_easy_to_use, locale="ja") == "とても長いキーでも簡単に使える。"
assert t(LONG_KEY + "but_easy_to_use", locale="ja") == "とても長いキーでも簡単に使える。"
```

## Documentation
See the [documentation](https://i21y.readthedocs.io/) for usage and details.

## Contributing Guide
This project is managed by the package manager PDM.  
In coding, please use Black as a code formatter and pyright for type checking. The configuration is described in `pyproject.toml`.  
Please write what you have done in a complete sentence and use the original form of the verb. e.g. `Fix that locale_str can't join`.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "i21y",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "i18n",
    "author": null,
    "author_email": "Takagi Tasuku <tasuren@outlook.jp>",
    "download_url": "https://files.pythonhosted.org/packages/71/20/07ce2aed439050ff2abe557f319eb0b24fc40b63726e8c74aebfcb805172/i21y-0.3.0.tar.gz",
    "platform": null,
    "description": "[![PyPI](https://img.shields.io/pypi/v/i21y)](https://pypi.org/project/i21y/)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/i21y)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/i21y)\n![PyPI - License](https://img.shields.io/pypi/l/i21y)\n[![Documentation Status](https://readthedocs.org/projects/i21y/badge/?version=latest)](https://i21y.readthedocs.io/en/latest/?badge=latest)\n[![Buy Me a Coffee](https://img.shields.io/badge/-tasuren-E9EEF3?label=Buy%20Me%20a%20Coffee&logo=buymeacoffee)](https://www.buymeacoffee.com/tasuren)\n\n# i21y\ni21y (a.k.a internationalization.py) is library for support i18n in Python. It is easy to use.\n\n**Features:**\n- Zero dependencies by default\n- Simple design\n- Utilities to simplify keys\n\n## Installation\nNormal: `pip install i21y`  \nYAML support: `pip install i21y[yaml]`  \nFast JSON (by orjson) support: `pip install i21y[fast-json]`\n\n## Example\n### Basic\n```python\nfrom i21y import Translator\nfrom i21y.loaders.json import Loader\n\nt = Translator(Loader(\"locale\"))\n\nassert t(\"main.responses.not_found\", locale=\"ja\") == \"\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u3002\"\n```\n### Advanced\n```python\nfrom i21y import locale_str\n\nLONG_KEY = locale_str(\"very.long.locale.key.yeah_so_long\")\nprint(LONG_KEY.but_easy_to_use) # very.long.locale.key.yeah_so_long.but_easy_to_use\n\nassert t(LONG_KEY.but_easy_to_use, locale=\"ja\") == \"\u3068\u3066\u3082\u9577\u3044\u30ad\u30fc\u3067\u3082\u7c21\u5358\u306b\u4f7f\u3048\u308b\u3002\"\nassert t(LONG_KEY + \"but_easy_to_use\", locale=\"ja\") == \"\u3068\u3066\u3082\u9577\u3044\u30ad\u30fc\u3067\u3082\u7c21\u5358\u306b\u4f7f\u3048\u308b\u3002\"\n```\n\n## Documentation\nSee the [documentation](https://i21y.readthedocs.io/) for usage and details.\n\n## Contributing Guide\nThis project is managed by the package manager PDM.  \nIn coding, please use Black as a code formatter and pyright for type checking. The configuration is described in `pyproject.toml`.  \nPlease write what you have done in a complete sentence and use the original form of the verb. e.g. `Fix that locale_str can't join`.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Takagi Tasuku  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "The simple library for i18n support.",
    "version": "0.3.0",
    "project_urls": {
        "Documentation": "https://i21y.readthedocs.io/",
        "Donate": "https://www.buymeacoffee.com/tasuren",
        "Source": "https://github.com/tasuren/i21y"
    },
    "split_keywords": [
        "i18n"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ba5481b1c08f16868590e84c738e2421c696094cef727022386bfffe23c306ac",
                "md5": "091e06449533fdd5ec729657a56b06d3",
                "sha256": "36d377c092f1b7ff11992a7e92b583edda53910599236d17870264ed37867c10"
            },
            "downloads": -1,
            "filename": "i21y-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "091e06449533fdd5ec729657a56b06d3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 11631,
            "upload_time": "2024-10-13T04:26:44",
            "upload_time_iso_8601": "2024-10-13T04:26:44.353141Z",
            "url": "https://files.pythonhosted.org/packages/ba/54/81b1c08f16868590e84c738e2421c696094cef727022386bfffe23c306ac/i21y-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "712007ce2aed439050ff2abe557f319eb0b24fc40b63726e8c74aebfcb805172",
                "md5": "c62d6197497669c7eaf398e021c6b282",
                "sha256": "1c03abdfaecded66af6f65fa3a6dd54839c1588130c254b0d4b55e266129c02a"
            },
            "downloads": -1,
            "filename": "i21y-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c62d6197497669c7eaf398e021c6b282",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 35680,
            "upload_time": "2024-10-13T04:26:45",
            "upload_time_iso_8601": "2024-10-13T04:26:45.672949Z",
            "url": "https://files.pythonhosted.org/packages/71/20/07ce2aed439050ff2abe557f319eb0b24fc40b63726e8c74aebfcb805172/i21y-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-13 04:26:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tasuren",
    "github_project": "i21y",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "i21y"
}
        
Elapsed time: 0.90748s