{"action":"created","issue":{"url":"https://api.github.com/repos/OCA/server-tools/issues/76","labels_url":"https://api.github.com/repos/OCA/server-tools/issues/76/labels{/name}","comments_url":"https://api.github.com/repos/OCA/server-tools/issues/76/comments","events_url":"https://api.github.com/repos/OCA/server-tools/issues/76/events","html_url":"https://github.com/OCA/server-tools/pull/76","id":47433947,"number":76,"title":"[ADD] transbot: Bot for synchronizing translations between Github and Transifex","user":{"login":"pedrobaeza","id":7165771,"avatar_url":"https://avatars.githubusercontent.com/u/7165771?v=3","gravatar_id":"","url":"https://api.github.com/users/pedrobaeza","html_url":"https://github.com/pedrobaeza","followers_url":"https://api.github.com/users/pedrobaeza/followers","following_url":"https://api.github.com/users/pedrobaeza/following{/other_user}","gists_url":"https://api.github.com/users/pedrobaeza/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrobaeza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrobaeza/subscriptions","organizations_url":"https://api.github.com/users/pedrobaeza/orgs","repos_url":"https://api.github.com/users/pedrobaeza/repos","events_url":"https://api.github.com/users/pedrobaeza/events{/privacy}","received_events_url":"https://api.github.com/users/pedrobaeza/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/OCA/server-tools/labels/needs+review","name":"needs review","color":"fbca04"}],"state":"open","locked":false,"assignee":{"login":"pedrobaeza","id":7165771,"avatar_url":"https://avatars.githubusercontent.com/u/7165771?v=3","gravatar_id":"","url":"https://api.github.com/users/pedrobaeza","html_url":"https://github.com/pedrobaeza","followers_url":"https://api.github.com/users/pedrobaeza/followers","following_url":"https://api.github.com/users/pedrobaeza/following{/other_user}","gists_url":"https://api.github.com/users/pedrobaeza/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrobaeza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrobaeza/subscriptions","organizations_url":"https://api.github.com/users/pedrobaeza/orgs","repos_url":"https://api.github.com/users/pedrobaeza/repos","events_url":"https://api.github.com/users/pedrobaeza/events{/privacy}","received_events_url":"https://api.github.com/users/pedrobaeza/received_events","type":"User","site_admin":false},"milestone":null,"comments":29,"created_at":"2014-10-31T19:11:25Z","updated_at":"2015-01-21T15:27:33Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/OCA/server-tools/pulls/76","html_url":"https://github.com/OCA/server-tools/pull/76","diff_url":"https://github.com/OCA/server-tools/pull/76.diff","patch_url":"https://github.com/OCA/server-tools/pull/76.patch"},"body":"I'm glad to present you Transbot, the utility I have developed for synchronizing translations between OCA Github repositories and a translation editting platform.\r\n\r\nI have selected Transifex, because it's a well know platform, that has a nice interface, with automatic suggestions between all our projects and the most important thing: it has an API that allows to interact remotely with it. I have made it through the package _txlib_, which can be downloaded from here: https://github.com/transifex/transifex-python-library, but unfortunately it can't be installed through pip or easy_install. This library is not the more efficient one, but it doesn't present any special problem and serves to do all I need. The package is not correctly detected by Odoo as an external dependency, so I have disabled this check.\r\n\r\nOn the other hand, Github presents a more complex API, and I have been struggled by some constraints with it. For example, it's very difficult to create a commit joining all the translations changed on one repo. That's why I make one commit per change. The library selected for acting as middleware with the GIthub API is the also well known PyGithub (https://github.com/jacquev6/PyGithub), which in current stable version doesn't support the possibility to make changes on repos (and the new alpha version also doesn't do it correctly), so I have injected through monkey-patching the function I need for this purpose. You can install it with `pip install PyGithub.`\r\n\r\nThe bot is presented as a regular Odoo module, so you will be familiar with its use.\r\n\r\nApart from the deployment requirements, these are the steps to get it properly running:\r\n\r\n* Configure a user and a password for Transifex. This cannot be done via a token, because Transifex doesn't allow this option. This data is stored as system parameters, so password is going to be in plain text, although in the configuration screen appears masked.\r\n* Configure a Transifex organization and team. Team is identified by a slug or name, derived from the real name you have put. The translation group is an id (number) that can be seen in the URL when you are on it on the web page.\r\n* The Transifex translation group must have added the corresponding languages that can be synchronized with Github, or you will get an error on contrary. But sorry, there is no Klingon language on Transifex :wink: \r\n* You have to issue a new token for the user you want to interact with on Github, with all the permissions granted, and put on the corresponding field on the configuration.\r\n* Last, you have to create a Github project record for each of the repos, putting the organization of the repo and the project name in it. There is no support for now for personal repos, only organization repos, but it's very easy to create an organization for you only.\r\n* You have to click on _Get branches_ button afterwards to retrieve current branches. You can deactivate any branch you don't want in the list (for example, dev branches).\r\n* Then, you can click on _Check Github updates_ to query active branches of the current Transbot project for new files, creating a Transifex project for each branch with this convention: `<project_name> (<branch_name>)`, and uploading pot and po files. Here there can be errors that are logged (for example, an empty translation file like fr_BE.po in vertical-hotel).\r\n* After this, you can click also on `Check Transifex updates`, which detects possible changes on translation strings on Transifex, and dump back on Github. This is awfully slow, but there's no other way, because it has to download each set of translation strings and check against saved hash, because Transifex doesn't provide any other method.\r\n* There are 2 crons that can be changed for automatic check of both sides.\r\n\r\nAny suggestion or question, just tell me.\r\n\r\nEnjoy!"},"comment":{"url":"https://api.github.com/repos/OCA/server-tools/issues/comments/70857088","html_url":"https://github.com/OCA/server-tools/pull/76#issuecomment-70857088","issue_url":"https://api.github.com/repos/OCA/server-tools/issues/76","id":70857088,"user":{"login":"StefanRijnhart","id":1033124,"avatar_url":"https://avatars.githubusercontent.com/u/1033124?v=3","gravatar_id":"","url":"https://api.github.com/users/StefanRijnhart","html_url":"https://github.com/StefanRijnhart","followers_url":"https://api.github.com/users/StefanRijnhart/followers","following_url":"https://api.github.com/users/StefanRijnhart/following{/other_user}","gists_url":"https://api.github.com/users/StefanRijnhart/gists{/gist_id}","starred_url":"https://api.github.com/users/StefanRijnhart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StefanRijnhart/subscriptions","organizations_url":"https://api.github.com/users/StefanRijnhart/orgs","repos_url":"https://api.github.com/users/StefanRijnhart/repos","events_url":"https://api.github.com/users/StefanRijnhart/events{/privacy}","received_events_url":"https://api.github.com/users/StefanRijnhart/received_events","type":"User","site_admin":false},"created_at":"2015-01-21T15:27:33Z","updated_at":"2015-01-21T15:27:33Z","body":"FYI, the power of pip:\r\n    pip install git+https://github.com/transifex/transifex-python-library.git"}}