{ "info": { "author": "GreenelyAB", "author_email": "info@greenely.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.5", "Topic :: Communications", "Topic :: Software Development :: Internationalization", "Topic :: Software Development :: Localization", "Topic :: Text Processing" ], "description": "TranslationsServer\n==================\n\n.. image:: https://api.travis-ci.org/GreenelyAB/TranslationsServer.svg?branch=master\n :target: https://travis-ci.org/GreenelyAB/TranslationsServer?branch=master\n\nManage, store and deliver translations.\n\n\nDefinition\n----------\n\nA *translation* starts out with a key, usually the English version of the text.\nFor each key there can be a translation for another language. That is the\nsecond parameter for a translation.\n\nA translation can also be country depended, the third parameter.\n\nThe last parameter specifies the plural version of the translation. This is\nneeded for when the translation refers to some amount and needs to be different\ndepending on what that amount is.\n\n\nRules for finding a translation\n-------------------------------\n\nThe parameters for getting a translation are:\n\n- **key**: the text to translate\n- **lang**: the language for the translation, following\n `ISO 639-1 `_\n- **country** [optional] the country for the translation, following\n `ISO 3166-1 alpha-2 `_\n- **plural** [optional] the related value that defines the plural form of\n the translation\n\nThe steps taken to find a translation are:\n\n- find all translations for the given key\n- only keep the ones with the specified language\n- from that list keep the ones with a matching country, if there are no entries\n with a matching country keep the ones without a specified country\n- if a plural parameter was specified try to find entries with that plural\n value otherwise select the translation where no plural value was specified\n- if more than one translations are left take the first one, if no translation\n is left take the key as the translation instead\n\n\nInstallation\n============\n\n- Prepare a `Postgres `_ database and user.\n- Install `npm `_.\n- Create and activate a\n `Python 3 virtual environment `_.\n- Clone/download the\n `project `_.\n- Then go to that project folder and run:\n ::\n\n $ npm install\n $ export TRANSLATIONS_SERVER_DB_URL=\"\"\n $ grunt migrate\n $ cd src\n $ cp config_local.py.example config_local.py\n- Review and edit this new file `config_local.py`.\n\n\nDatabase URL example\n--------------------\n\nConnecting to a database named `test`on a local postgres server with user\n`postgres` and no password: \"`postgres://postgres:@127.0.0.1/test`\"\n\n\nRun\n===\n\nAfter completing the installation and activating the Python environment go to\nthe project folder and start a development server like this:\n::\n\n $ cd src\n $ ./main.py\n\n\nHow you run your server in production depends on your production environment.\n\nRun `./main.py --help` for port options.\n\n\nRun tests\n---------\n\nPrepare an empty test database and configure it in through\n`TRANSLATIONS_SERVER_TEST_DB_URL` in `config_local.py`. Then go to the project\nfolder and run:\n::\n\n $ cd test\n $ ./run_tests.py\n\n\nAdd and edit translations\n=========================\n\nTheres are each a table for languages and countries. If a new alnguage or\ncountry is needed those tables need to be updated first:\n::\n\n translations_server=# INSERT INTO languages (language_code, name)\n VALUES ('en', 'English');\n translations_server=# INSERT INTO countries (country_code, name)\n VALUES ('US', 'United States of America');\n\n\nThere is no support for states, yet. Optionally one could modify the countrie\ncodes to include the states information.\n\nAll translations then reside in the `translations` table, which contains:\n\n- **translation_id**\n- **translation_key**: The key (original text) for the translation.\n- **language_id**: References `languages`.\n- **country_id**: References `countries`.\n- **plural**: The plural count (variation) for which this translation is for.\n- **translation_text**: The translated text.\n\nThe table can be manipulated by either working on it directly or by using a\nadmin interface such as\n`Django admin `_ (use\n`Multiple databases\n`_).\n\n\nZMQ protocol\n============\n\nThe server takes on request at the configured port number and responds with a\nreplay to each request.\n\nEach request shall send at least 4 frames containing:\n\n- language\n- country or ```\"\"```\n- key\n- plural or ```\"\"```\n\nEach request may further contain more frames in pairs, each containing:\n\n- key\n- plural or ```\"\"```\n\nFor example:\n::\n\n \"sv\"\n \"\"\n \"User not active\"\n \"\"\n\nAn example requesting two translations:\n::\n\n \"sv\"\n \"\"\n \"User not active\"\n \"\"\n \"User not found\"\n \"\"\n\nThe server shall then respond with either exactly one frame containing an\nempty string or as many frames as keys where send, each containing the\ntranslation for the corresponding key.\n\nThe response with only one frame containing an empty strings signals a server\nerror.\n\nResponse example for requesting two keys:\n::\n\n \"Anv\u00e4ndare ej aktiv\"\n \"User not found\"", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/GreenelyAB/TranslationsServer", "keywords": "store manage translation translations server internationalization", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "TranslationsServer", "package_url": "https://pypi.org/project/TranslationsServer/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/TranslationsServer/", "project_urls": { "Homepage": "https://github.com/GreenelyAB/TranslationsServer" }, "release_url": "https://pypi.org/project/TranslationsServer/0.1.1/", "requires_dist": [ "DBQuery (>=0.3.1)", "psycopg2 (>=2.6.1)", "pyzmq (>=15.2.0)" ], "requires_python": "", "summary": "The translations service server", "version": "0.1.1" }, "last_serial": 2255243, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "5d8981c32cdc3304f9d7ae3052ddfa8c", "sha256": "421a6f703c1d0ae1f00250c206feaf24aa93430af680613fc497a7028f3f8f9d" }, "downloads": -1, "filename": "TranslationsServer-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "5d8981c32cdc3304f9d7ae3052ddfa8c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10816, "upload_time": "2016-07-25T13:47:03", "url": "https://files.pythonhosted.org/packages/c8/8b/50fad9adf59b84bd971af761967238e1f3a3b2a687f4621739e82302e34e/TranslationsServer-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "895498776bfff0db62c5c9876c635e42", "sha256": "7c08888f945b29e47e6150bd6dd65604364b7d24af0d69335ae5524d3d3edb23" }, "downloads": -1, "filename": "TranslationsServer-0.1.0.tar.gz", "has_sig": false, "md5_digest": "895498776bfff0db62c5c9876c635e42", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7855, "upload_time": "2016-07-25T13:47:06", "url": "https://files.pythonhosted.org/packages/83/50/42dc14b6d837c07f3ab05a78f5de285a30f13d2c7fb820cef23d4d34ea78/TranslationsServer-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "855e4634649c5cc10046f74e7ac0c390", "sha256": "1065405929b01b7b7711ea2bd5220f12a76c5049f866480098d53fb78a43f9f0" }, "downloads": -1, "filename": "TranslationsServer-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "855e4634649c5cc10046f74e7ac0c390", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10878, "upload_time": "2016-08-01T13:38:40", "url": "https://files.pythonhosted.org/packages/50/32/b05bc1cfdea7bd355057b96acb5f6571ae3814c072eeeb58e1915663f3cd/TranslationsServer-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d5769aca28c6b1cd58993d7eff356a49", "sha256": "4e0be2438fa363de16660930bda9e54a940c188872ec778f8213a16e9c2033a0" }, "downloads": -1, "filename": "TranslationsServer-0.1.1.tar.gz", "has_sig": false, "md5_digest": "d5769aca28c6b1cd58993d7eff356a49", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7916, "upload_time": "2016-08-01T13:38:43", "url": "https://files.pythonhosted.org/packages/b1/23/0a3965deab2f24b9f831fc85f75466ecb092b5185dbab37152d93aa59e46/TranslationsServer-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "855e4634649c5cc10046f74e7ac0c390", "sha256": "1065405929b01b7b7711ea2bd5220f12a76c5049f866480098d53fb78a43f9f0" }, "downloads": -1, "filename": "TranslationsServer-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "855e4634649c5cc10046f74e7ac0c390", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10878, "upload_time": "2016-08-01T13:38:40", "url": "https://files.pythonhosted.org/packages/50/32/b05bc1cfdea7bd355057b96acb5f6571ae3814c072eeeb58e1915663f3cd/TranslationsServer-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d5769aca28c6b1cd58993d7eff356a49", "sha256": "4e0be2438fa363de16660930bda9e54a940c188872ec778f8213a16e9c2033a0" }, "downloads": -1, "filename": "TranslationsServer-0.1.1.tar.gz", "has_sig": false, "md5_digest": "d5769aca28c6b1cd58993d7eff356a49", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7916, "upload_time": "2016-08-01T13:38:43", "url": "https://files.pythonhosted.org/packages/b1/23/0a3965deab2f24b9f831fc85f75466ecb092b5185dbab37152d93aa59e46/TranslationsServer-0.1.1.tar.gz" } ] }