Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Zanata Python Client

Zanata Python Client

Zanata Python client is a client that communicates with a Zanata server to push text for translation and pull translated text back for inclusion in software or documentation builds.

Presented at PythonPune, @GS_Labs

Sundeep Anand

October 22, 2016
Tweet

More Decks by Sundeep Anand

Other Decks in Technology

Transcript

  1. Why to localize apps make Some non-english users want to

    give a try to your app. Probably you have plans to launch your app in a new territory say - Japan!! { “my_app”: “brand_new”} { “my_app”: “i18n-ed”} { “my_app”: “l10n-ed”} { “my_app”: “ship_ready”} Translation Platform i18n: Engineering Changes l10n: Extract - Push - Translate - Pull - Merge g11n
  2. Where Zanata lies which Zanata is a web-based system for

    translators, content creators and developers to manage localisation projects. http://zanata.org/ Open Source Translation Platform well adopted in communities - https://translate.zanata.org/ - https://fedora.zanata.org/ - https://translate.openstack.org/ - https://translate.jboss.org/ Docs: http://docs.zanata.org/en/release/ Projects - Versions Groups Languages Glossaries REST API https://zanata.ci.cloudbees.com/job/zanata-api-site/site/zanata-common-api/rest-api-docs/index.html Push Pull
  3. Zanata Python Client help Usage: zanata <command> [COMMANDOPTION]... list of

    commands: glossary push Push the glossary files to Zanata server help Display this help and exit init Initialize Zanata project configuration list List all available projects po pull Pull the content of gettext project po push Push the content of gettext project to Zanata server project create Create a project project info Show information about a project publican pull Pull the content of publican (podir) project publican push Push the content of publican (podir) project to Zanata server pull Pull the content of software project/docbook project from Zanata server push Push the content of software project/docbook project to Zanata server stats Displays translation statistics for a Zanata project version version create Create a version within a project version info Show information about a version available system options: --help Display this help or detail usage of commands --version Display python client version Use 'zanata help' for the full list of commands Use 'zanata help <command>, zanata <command> --help or zanata <command> -h' for detail usage of commands User Config (.ini) Project Config (.xml) z-p-c cli app ZNTA REST APIs
  4. Code </> tree [1] Configuration (Remote, Local: zanata.ini, zanata.xml, command-line)

    context.py, parseconfig.py [2] Commands - Interface and their implementation zanata.py, command.py, zanatacmd.py, cmdbase.py, pushcmd.py, pullcmd.py, initcmd.py [3] REST APIs - Commands Logic to REST Resource mapping zanatalib/rest/client.py, zanatalib/rest/config.py, resource.py, service.py docservice.py, glossaryservice.py, projectservice.py, statservice.py, versionservice.py [4] Others: utilities, converters, parsers, logger, error publicanutil.py, projectutils.py, csvconverter.py, parseconfig.py, logger.py, error.py [5] Requirements requirements.txt, requirements-dev.txt
  5. API Resources curl - Projects list projects - Project individual

    project CRUD - Project Iteration project_version CRUD - Source Doc push/list templates/docs - Translated Doc pull translations - Project Locales list language codes - Project Iteration Locales locale_mapping - Statistics translation stats - Glossary glossaries CRUD { "id": "plm", "defaultType" : "Gettext", "name": "PLM", "description" : "Translations of the Programmer's Learning Machine.", "iterations" : [ { "id": "ui", "links": [ { "href": "iterations/i/ui", "rel": "self", "type": "application/vnd.zanata.project.iteration+json" } ], "status" : "ACTIVE", "projectType" : "Gettext" }, { "id": "missions", "links": [ { "href": "iterations/i/missions", "rel": "self", "type": "application/vnd.zanata.project.iteration+json" } ], "status" : "ACTIVE", "projectType" : "Gettext" } ], "status" : "ACTIVE" }
  6. Walk-through exec Commands: - Initialize a project configuration zanata init

    - Push some gettext templates zanata push - Pull all the translation back zanata pull - Let’s see some statistics zanata stats
  7. How to start contribution git - Look for Bugs -

    https://github.com/sundeep-co-in/zanata-python-client/issues - https://bugzilla.redhat.com, bug_status=open, component=zanata-python-client - https://zanata.atlassian.net/secure/Dashboard.jspa - Setup devel environment - $ workon zpc && cd <project-location> - $ git clone https://github.com/zanata/zanata-python-client.git - $ pip install -r requirements-dev.txt - $ git checkout -b <my_branch> - Submit your changes upstream - After some code changes, $ make flake8 test - Create pull request, if possible link your PR with JIRA ticket - Code-review > QA > Merge
  8. Users (vs. developers) stat - Java-Client supported by Zanata Team

    - Python-Client community driven - Some developers use z-p-c in - fedora-infra team - installer engineering team Many python based large projects are interested in Python-Client - Because this sets chance where they can contribute into the project - 140 commits, 51 releases and 16 contributors as on Oct 20, 2016
  9. Where to look for help talk - Catch Zanata Team

    at IRC freenode #zanata - write to - [email protected] - [email protected] - [email protected] Q & A _______________________________________________________________________ Thank You!!