{ "info": { "author": "Farhan Arshad", "author_email": "icuintl@us.ibm.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Localization" ], "description": "\n\ngp-python-client\n----------------\n`gp-python-client` is the official Python client for [IBM Globalization Pipeline](https://cloud.ibm.com/docs/services/GlobalizationPipeline).\n\nIBM Globalization Pipeline is a DevOps integrated application translation management service that you can use to rapidly translate and release cloud and mobile applications to your global customers. Access IBM Globalization Pipeline capabilities through its dashboard, RESTful API, or integrate it seamlessly into your application's Delivery Pipeline.\n\nThis package expands on the [gettext module](https://docs.python.org/2/library/gettext.html) (avaliable as part of the Python standard library) and provides functionality for Python applications to use the Globalization Pipeline service.\n\nGetting started\n---------------\nTo get started, you should familiarize yourself with the service itself. A\ngood place to begin is by reading the [Quick Start Guide](https://github.com/IBM-Cloud/gp-common#quick-start-guide) and the official [Getting Started with IBM Globalization ](https://cloud.ibm.com/docs/services/GlobalizationPipeline) documentation.\n\nThe documentation explains how to find the service on IBM Cloud; authentication mechanisms supported; create a new service instance; create a new bundle; access the translated messages.\n\nDemo\n----\nThis [demo Bluemix app](http://gp-python-client-demo.mybluemix.net/) uses the Globalization Pipeline with the Python client to display a short welcome message that is translated in several languages. The source code for the demo app can be found in the [demo dir](./demo).\n\nInstallation\n------------\nTo install `gp-python-client`, simply run:\n\n```shell\n$ pip install gp-python-client\n```\n\nOr if you're oldschool, run:\n\n```shell\n$ easy_install gp-python-client\n```\n\nAPI\n---\nThe API documentation for the package can be found [here](http://pythonhosted.org/gp-python-client/). If the link is broken, you can [generate the documentation ](#generating-documentation) yourself.\n\nExamples\n--------\n**Example 1 - Bluemix app:**\n\nThis sample code will allow you to get started using the Globalization Pipeline service in your Bluemix app. The example assumes the Bluemix app has been connected to a Globalization Pipeline service instance and has a bundle named `myBundle`, and that the bundle contains a source string with key `greet`.\n\n```python\n>>> from gpclient import GPClient, GPServiceAccount, GPTranslations\n>>> import locale\n>>>\n>>> acc = GPServiceAccount()\n>>> client = GPClient(acc)\n>>>\n>>> languages=[locale.getdefaultlocale()[0]] # languages=['fr_CA']\n>>>\n>>> t = client.translation(bundleId='myBundle', languages=languages)\n>>> _ = t.gettext # create alias for method\n>>>\n>>> print _('greet') # 'greet' key's French translated value will be used\nBonjour\n>>>\n```\n\n**Example 2 - Non-Bluemix app:**\n\nThis sample code will allow you to get started using the Globalization Pipeline service in a standalone Python app that is not hosted on Bluemix. The example assumes a Globalization Pipeline service instance exists with a bundle named `myBundle`, and that the bundle contains a source string with key `exit`.\n\nYou will need the [service instance credentials](https://github.com/IBM-Bluemix/gp-common#4-credentials).\n\n```python\n>>> from gpclient import GPClient, GPServiceAccount, GPTranslations\n>>> import locale\n>>>\n>>> acc = GPServiceAccount(url=url, instanceId=instId,\n userId=userId, password=passwd) # Using Globalization Pipeline authentication\n# Using IAM \n# acc = GPServiceAccount(url=url, instanceId=instanceId,\n# apiKey=apiKey)\n>>> client = GPClient(acc)\n>>>\n>>> languages=[locale.getdefaultlocale()[0]] # languages=['es-mx']\n>>>\n>>> t = client.translation(bundleId='myBundle', languages=languages)\n>>> _ = t.gettext # create alias for method\n>>>\n>>> print _('exit') # 'exit' key's Spanish translated value will be used\nAdi\u00f3s\n>>>\n```\n\nYou can also provide the service credentials through a JSON file as shown in the snippet below\n\n```python\n>>> from gpclient import GPClient, GPServiceAccount\n>>>\n>>> acc = GPServiceAccount(credentialsJson=\"./local_credentials.json\")\n>>> client = GPClient(acc)\n```\n\nObtaining language/locale codes\n-------------------------------\nThis package requires that valid (BCP47 compliant) language/locale codes be provided when asked; for example, when calling `GPClient.translation()` (see [Examples](#examples)). From these codes, the language, region, and script subtags will be extracted.\n\nSome example codes are:\n\n* zh-Hans\n* pt-BR\n* ja\n* en_US\n\nThere are several ways to get the code for the working locale. One way\nis to use the [locale module](https://docs.python.org/2/library/locale.html) (avaliable as part of the Python standard library).\n\n```python\n>>> import locale\n>>> myLocale = locale.getdefaultlocale()\n>>> print myLocale\n('en_US', 'UTF-8')\n>>> code = myLocale[0]\n>>> print code\nen_US\n```\n\nFor the above example, the language code is `en_US` - where `en` is the language subtag, and `US` is the region subtag.\n\nRunning Tests\n-------------\nRefer to [test/README.md](./test/README.md).\n\nGenerating documentation\n------------------------\nDocumentation can be generated using [Sphinx](http://www.sphinx-doc.org).\n\nYou must first install it:\n\n```shell\n$ pip install sphinx\n```\n\nThen, to auto generate the documentation, run:\n\n```shell\n$ cd $BASEDIR/docs\n$ make clean\n$ make html\n```\n\nTo navigate the documentation, open `$BASEDIR/docs/_build/html/index.html`.\n\nCreating distribution package\n-----------------------------\nFirst update `CHANGES.txt` and `setup.py` if necessary (e.g. update version number), then create the preferred [distribution package](http://python-packaging-user-guide.readthedocs.org/en/latest/distributing/#packaging-your-project).\n\n**Wheel distribution** (Recommended)\n\n```shell\n$ pip install wheel\n$ python setup.py bdist_wheel\n```\n\n**Source distribution**\n\n```shell\n$ python setup.py sdist\n```\n\nNote: Source distribution contains tests as well.\n\n**Build distribution**\n\n```shell\n$ python setup.py bdist\n```\n\nThe new distribution files should be located under `$BASEDIR/dist/`.\n\nCommunity\n---------\n* View or file GitHub [Issues](https://github.com/IBM-Cloud/gp-python-client/issues)\n* Connect with the open source community on [developerWorks Open](https://developer.ibm.com/open/ibm-bluemix-globalization-pipeline-service/python-sdk/)\n\nContributing\n------------\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n\nLicense\n-------\nApache 2.0. See [LICENSE.txt](LICENSE.txt).\n\n> Licensed under the Apache License, Version 2.0 (the \"License\");\n> you may not use this file except in compliance with the License.\n> You may obtain a copy of the License at\n>\n> http://www.apache.org/licenses/LICENSE-2.0\n>\n> Unless required by applicable law or agreed to in writing, software\n> distributed under the License is distributed on an \"AS IS\" BASIS,\n> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n> See the License for the specific language governing permissions and\n> limitations under the License.\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/IBM-Cloud/gp-python-client", "keywords": "client globalization pipline ibm bluemix", "license": "Apache License Version 2.0", "maintainer": "", "maintainer_email": "", "name": "gp-python-client-sid", "package_url": "https://pypi.org/project/gp-python-client-sid/", "platform": "", "project_url": "https://pypi.org/project/gp-python-client-sid/", "project_urls": { "Homepage": "https://github.com/IBM-Cloud/gp-python-client" }, "release_url": "https://pypi.org/project/gp-python-client-sid/1.1.0/", "requires_dist": [ "requests", "babel", "dateutils" ], "requires_python": "", "summary": "Python client for Globalization Pipeline on IBM Cloud", "version": "1.1.0" }, "last_serial": 5208653, "releases": { "1.1.0": [ { "comment_text": "", "digests": { "md5": "8e92ed635895e537647e99ed9b81687a", "sha256": "7317eca2acf30250738a4ecabd73fecfefb8c0c803f5fb6102914fc022ce6428" }, "downloads": -1, "filename": "gp_python_client_sid-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8e92ed635895e537647e99ed9b81687a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 19498, "upload_time": "2019-04-30T15:10:30", "url": "https://files.pythonhosted.org/packages/af/70/8749f78ce8fe25fbcffb74f24aabb6741c49a8c7f7ea7dc8f752f3a25441/gp_python_client_sid-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8933a425a9e442779cff0bc878326f8f", "sha256": "ebad8e50f8082f20b252376cb52c7f5048fc2e8a5861a79224578f665348ac6a" }, "downloads": -1, "filename": "gp-python-client-sid-1.1.0.tar.gz", "has_sig": false, "md5_digest": "8933a425a9e442779cff0bc878326f8f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35891, "upload_time": "2019-04-30T15:10:43", "url": "https://files.pythonhosted.org/packages/cb/bd/765cbbdc321fec69865d2b912fbfef4d0deda3e845a4ae9311fa1e88ec60/gp-python-client-sid-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8e92ed635895e537647e99ed9b81687a", "sha256": "7317eca2acf30250738a4ecabd73fecfefb8c0c803f5fb6102914fc022ce6428" }, "downloads": -1, "filename": "gp_python_client_sid-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8e92ed635895e537647e99ed9b81687a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 19498, "upload_time": "2019-04-30T15:10:30", "url": "https://files.pythonhosted.org/packages/af/70/8749f78ce8fe25fbcffb74f24aabb6741c49a8c7f7ea7dc8f752f3a25441/gp_python_client_sid-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8933a425a9e442779cff0bc878326f8f", "sha256": "ebad8e50f8082f20b252376cb52c7f5048fc2e8a5861a79224578f665348ac6a" }, "downloads": -1, "filename": "gp-python-client-sid-1.1.0.tar.gz", "has_sig": false, "md5_digest": "8933a425a9e442779cff0bc878326f8f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35891, "upload_time": "2019-04-30T15:10:43", "url": "https://files.pythonhosted.org/packages/cb/bd/765cbbdc321fec69865d2b912fbfef4d0deda3e845a4ae9311fa1e88ec60/gp-python-client-sid-1.1.0.tar.gz" } ] }