{ "info": { "author": "Leonid Kozarin", "author_email": "kozalo@sadbot.ru", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Software Development :: Internationalization", "Topic :: Software Development :: Libraries" ], "description": "klocmod -- Kozalo's Localization Module\n======================================\n\n*Screw you, gettext! I don't wanna bother of compiling strings into binary files!*\n\n[![Build Status](https://travis-ci.org/kozalosev/klocmod.svg?branch=master)](https://travis-ci.org/kozalosev/klocmod)\n[![Documentation Status](https://readthedocs.org/projects/klocmod/badge/?version=latest)](https://klocmod.readthedocs.io/en/latest/?badge=latest)\n\nThis module provides a very simple, suboptimal way for localizing your scripts, bots or applications. The advantage is\nits simplicity: to supply some sets of different string literals for different languages, you just need a simple JSON or\nINI file (or even a dict) fed to the library. After that, the only thing you should take care of is to get an instance\nof the dictionary for a specific language and extract messages from it by key values.\n\nAll you mostly want is the `LocalizationsContainer` class. In particular, its static method \n`LocalizationsContainer.from_file()` that reads a localization file and returns an instance of the factory. The factory\nis supposed to produce instances of the `LanguageDictionary` class. Most likely, you will encounter instances of its\nsubclass -- the `SpecificLanguageDictionary` class (the base class is only used as a fallback that returns passed key\nvalues back).\n\nExamples of localization files\n------------------------------\n\n### JSON (language first)\n\n\n```json\n{\n \"en\": {\n \"yes\": \"yes\",\n \"no\": \"no\"\n },\n \"ru-RU\": {\n \"yes\": \"\u0434\u0430\",\n \"no\": \"\u043d\u0435\u0442\"\n }\n}\n```\n\n### JSON (phrase first)\n\n```json\n{\n \"yes\": {\n \"en\": \"yes\",\n \"ru-RU\": \"\u0434\u0430\"\n },\n \"no\": {\n \"en\": \"no\",\n \"ru-RU\": \"\u043d\u0435\u0442\"\n }\n}\n```\n\n### INI\n\n```ini\n[DEFAULT]\nyes = yes\nno = no\n\n[ru-RU]\nyes = \u0434\u0430\nno = \u043d\u0435\u0442\n```\n\n\nCode example\n------------\n\n```python\nfrom klocmod import LocalizationsContainer\n\nlocalizations = LocalizationsContainer.from_file(\"localization.json\")\nru = localizations.get_lang(\"ru\")\n# or\nen = localizations.get_lang() # get default language\n# then\nprint(ru['yes']) # output: \u0434\u0430\n# alternative ways to get a specific phrase:\nlocalizations.get_phrase(\"ru-RU\", \"no\")\nlocalizations['ru-RU']['no']\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kozalosev/klocmod", "keywords": "localization library", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "klocmod", "package_url": "https://pypi.org/project/klocmod/", "platform": "", "project_url": "https://pypi.org/project/klocmod/", "project_urls": { "Homepage": "https://github.com/kozalosev/klocmod" }, "release_url": "https://pypi.org/project/klocmod/0.2.0/", "requires_dist": [ "PyYAML; extra == 'yaml'" ], "requires_python": "", "summary": "A simple module providing facilities to localize small programs via textual files.", "version": "0.2.0" }, "last_serial": 4404265, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "b95ccdbb54a1b1ae99f8c148dacfbce1", "sha256": "c20a75da2680883be0aa15cbc73bef1e705a7bc528c977f2666c7e4ba9c605c6" }, "downloads": -1, "filename": "klocmod-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b95ccdbb54a1b1ae99f8c148dacfbce1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7197, "upload_time": "2018-10-07T09:13:13", "url": "https://files.pythonhosted.org/packages/3d/6f/8904a1ec2589426b31d35123c9ea17f73c7797af31625a03f054f9510a3b/klocmod-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "198bf1885b70013ddc06e38cf06fe9d5", "sha256": "d431cf1c8e6eaa95c23a27fd111e561be27d800cbea29e76d86a7e7b6efb5300" }, "downloads": -1, "filename": "klocmod-0.1.0.tar.gz", "has_sig": false, "md5_digest": "198bf1885b70013ddc06e38cf06fe9d5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22618, "upload_time": "2018-10-07T09:13:14", "url": "https://files.pythonhosted.org/packages/89/96/3ab31762952d301c2e0a76a0bd9cecb5daca53d37646608a46e038e4dd01/klocmod-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "4aa28c4ae8b052fcc9e02832d0b06472", "sha256": "0b7df4064fc5ccc555d64c9d4e53a3d7aa456287823c143be1f65547c5c26f49" }, "downloads": -1, "filename": "klocmod-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "4aa28c4ae8b052fcc9e02832d0b06472", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8122, "upload_time": "2018-10-22T23:45:15", "url": "https://files.pythonhosted.org/packages/c4/e1/a944e5e942b669c48e87d4753d2b95fb015fa2dcdeb5b4f4d14979faff94/klocmod-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "adbd9af2d9218ba9d82bf3d2cf6bc292", "sha256": "09bb98b98d85e9f2a1a5d0d9b242e538404600099fa0830cf4ccdc39819c0dd2" }, "downloads": -1, "filename": "klocmod-0.2.0.tar.gz", "has_sig": false, "md5_digest": "adbd9af2d9218ba9d82bf3d2cf6bc292", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23234, "upload_time": "2018-10-22T23:45:17", "url": "https://files.pythonhosted.org/packages/23/7f/8493902d4d4237fc2b895c7b910789ec121740265c0bbfcb2582da351d74/klocmod-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4aa28c4ae8b052fcc9e02832d0b06472", "sha256": "0b7df4064fc5ccc555d64c9d4e53a3d7aa456287823c143be1f65547c5c26f49" }, "downloads": -1, "filename": "klocmod-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "4aa28c4ae8b052fcc9e02832d0b06472", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8122, "upload_time": "2018-10-22T23:45:15", "url": "https://files.pythonhosted.org/packages/c4/e1/a944e5e942b669c48e87d4753d2b95fb015fa2dcdeb5b4f4d14979faff94/klocmod-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "adbd9af2d9218ba9d82bf3d2cf6bc292", "sha256": "09bb98b98d85e9f2a1a5d0d9b242e538404600099fa0830cf4ccdc39819c0dd2" }, "downloads": -1, "filename": "klocmod-0.2.0.tar.gz", "has_sig": false, "md5_digest": "adbd9af2d9218ba9d82bf3d2cf6bc292", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23234, "upload_time": "2018-10-22T23:45:17", "url": "https://files.pythonhosted.org/packages/23/7f/8493902d4d4237fc2b895c7b910789ec121740265c0bbfcb2582da351d74/klocmod-0.2.0.tar.gz" } ] }