{"action":"created","comment":{"url":"https://api.github.com/repos/translate/translate/pulls/comments/75520181","id":75520181,"diff_hunk":"@@ -0,0 +1,102 @@\n+#!/usr/bin/env python\n+# -*- coding: utf-8 -*-\n+#\n+# Copyright 2016 Zuza Software Foundation\n+#\n+# This file is part of translate.\n+#\n+# translate is free software; you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation; either version 2 of the License, or\n+# (at your option) any later version.\n+#\n+# translate is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with this program; if not, see <http://www.gnu.org/licenses/>.\n+\n+\"\"\"Convert Gettext PO localization files to .ftl files.\n+\"\"\"\n+\n+import logging\n+\n+from translate.convert import convert\n+from translate.storage import po, l20n\n+\n+\n+logger = logging.getLogger(__name__)\n+\n+\n+class po2l20n(object):\n+\n+    def __init__(self, inputfile, outputfile, templatefile=None,\n+                 includefuzzy=False, outputthreshold=None):\n+\n+        if templatefile is None:\n+            raise ValueError(\"must have template file for ftl files\")\n+\n+        self.inputstore = po.pofile(inputfile)\n+        self.outputfile = outputfile\n+        self.template_store = l20n.l20nfile(templatefile)\n+        self.includefuzzy = includefuzzy\n+        self.outputthreshold = outputthreshold\n+\n+    def run(self):\n+        should_output_store = convert.should_output_store(self.inputstore,\n+                                                          self.outputthreshold)\n+        if not should_output_store:\n+            return False\n+\n+        self.convert_store().serialize(self.outputfile)\n+        return True\n+\n+    def convert_unit(self, unit):\n+        l20n_unit_value = unit.target or unit.source\n+        l20n_unit = l20n.l20nunit(\n+            source=l20n_unit_value,\n+            id=unit.getlocations()[0],\n+            comment=unit.getnotes(\"developer\")\n+        )\n+        return l20n_unit\n+\n+    def convert_store(self):\n+        outputstore = l20n.l20nfile()\n+        self.inputstore.makeindex()\n+\n+        for l20nunit in self.template_store.units:\n+            l20nunit_id = l20nunit.getid()\n+\n+            if l20nunit_id in self.inputstore.locationindex:\n+                po_unit = self.inputstore.locationindex[l20nunit_id]\n+                newunit = self.convert_unit(po_unit)\n+                outputstore.addunit(newunit)\n+\n+        return outputstore\n+\n+\n+def convertl20n(inputfile, outputfile, templatefile, includefuzzy=False,\n+                outputthreshold=None):\n+    return po2l20n(inputfile, outputfile, templatefile, includefuzzy,\n+                   outputthreshold).run()\n+\n+\n+formats = {\n+    (\"po\", \"ftl\"): (\"ftl\", convertl20n),\n+    \"po\": (\"ftl\", convertl20n),","path":"translate/convert/po2l20n.py","position":88,"original_position":88,"commit_id":"0818785dd5b2e2d5ceef34820395a1609510f793","original_commit_id":"0818785dd5b2e2d5ceef34820395a1609510f793","user":{"login":"unho","id":939880,"avatar_url":"https://avatars.githubusercontent.com/u/939880?v=3","gravatar_id":"","url":"https://api.github.com/users/unho","html_url":"https://github.com/unho","followers_url":"https://api.github.com/users/unho/followers","following_url":"https://api.github.com/users/unho/following{/other_user}","gists_url":"https://api.github.com/users/unho/gists{/gist_id}","starred_url":"https://api.github.com/users/unho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unho/subscriptions","organizations_url":"https://api.github.com/users/unho/orgs","repos_url":"https://api.github.com/users/unho/repos","events_url":"https://api.github.com/users/unho/events{/privacy}","received_events_url":"https://api.github.com/users/unho/received_events","type":"User","site_admin":false},"body":"This is lacking the l20n extension scenario.","created_at":"2016-08-19T17:26:58Z","updated_at":"2016-08-19T17:26:58Z","html_url":"https://github.com/translate/translate/pull/3474#discussion_r75520181","pull_request_url":"https://api.github.com/repos/translate/translate/pulls/3474","_links":{"self":{"href":"https://api.github.com/repos/translate/translate/pulls/comments/75520181"},"html":{"href":"https://github.com/translate/translate/pull/3474#discussion_r75520181"},"pull_request":{"href":"https://api.github.com/repos/translate/translate/pulls/3474"}}},"pull_request":{"url":"https://api.github.com/repos/translate/translate/pulls/3474","id":79566207,"html_url":"https://github.com/translate/translate/pull/3474","diff_url":"https://github.com/translate/translate/pull/3474.diff","patch_url":"https://github.com/translate/translate/pull/3474.patch","issue_url":"https://api.github.com/repos/translate/translate/issues/3474","number":3474,"state":"open","locked":false,"title":"Add basic L20n support","user":{"login":"ta2-1","id":682845,"avatar_url":"https://avatars.githubusercontent.com/u/682845?v=3","gravatar_id":"","url":"https://api.github.com/users/ta2-1","html_url":"https://github.com/ta2-1","followers_url":"https://api.github.com/users/ta2-1/followers","following_url":"https://api.github.com/users/ta2-1/following{/other_user}","gists_url":"https://api.github.com/users/ta2-1/gists{/gist_id}","starred_url":"https://api.github.com/users/ta2-1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ta2-1/subscriptions","organizations_url":"https://api.github.com/users/ta2-1/orgs","repos_url":"https://api.github.com/users/ta2-1/repos","events_url":"https://api.github.com/users/ta2-1/events{/privacy}","received_events_url":"https://api.github.com/users/ta2-1/received_events","type":"User","site_admin":false},"body":"Add basic L20n support","created_at":"2016-08-01T13:15:28Z","updated_at":"2016-08-19T17:26:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cbf774cd2775edbdcb0c5972a6fe887d5cdd397d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/translate/translate/pulls/3474/commits","review_comments_url":"https://api.github.com/repos/translate/translate/pulls/3474/comments","review_comment_url":"https://api.github.com/repos/translate/translate/pulls/comments{/number}","comments_url":"https://api.github.com/repos/translate/translate/issues/3474/comments","statuses_url":"https://api.github.com/repos/translate/translate/statuses/0818785dd5b2e2d5ceef34820395a1609510f793","head":{"label":"ta2-1:l20n-db","ref":"l20n-db","sha":"0818785dd5b2e2d5ceef34820395a1609510f793","user":{"login":"ta2-1","id":682845,"avatar_url":"https://avatars.githubusercontent.com/u/682845?v=3","gravatar_id":"","url":"https://api.github.com/users/ta2-1","html_url":"https://github.com/ta2-1","followers_url":"https://api.github.com/users/ta2-1/followers","following_url":"https://api.github.com/users/ta2-1/following{/other_user}","gists_url":"https://api.github.com/users/ta2-1/gists{/gist_id}","starred_url":"https://api.github.com/users/ta2-1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ta2-1/subscriptions","organizations_url":"https://api.github.com/users/ta2-1/orgs","repos_url":"https://api.github.com/users/ta2-1/repos","events_url":"https://api.github.com/users/ta2-1/events{/privacy}","received_events_url":"https://api.github.com/users/ta2-1/received_events","type":"User","site_admin":false},"repo":{"id":62902846,"name":"translate","full_name":"ta2-1/translate","owner":{"login":"ta2-1","id":682845,"avatar_url":"https://avatars.githubusercontent.com/u/682845?v=3","gravatar_id":"","url":"https://api.github.com/users/ta2-1","html_url":"https://github.com/ta2-1","followers_url":"https://api.github.com/users/ta2-1/followers","following_url":"https://api.github.com/users/ta2-1/following{/other_user}","gists_url":"https://api.github.com/users/ta2-1/gists{/gist_id}","starred_url":"https://api.github.com/users/ta2-1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ta2-1/subscriptions","organizations_url":"https://api.github.com/users/ta2-1/orgs","repos_url":"https://api.github.com/users/ta2-1/repos","events_url":"https://api.github.com/users/ta2-1/events{/privacy}","received_events_url":"https://api.github.com/users/ta2-1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ta2-1/translate","description":"Useful localization tools with Python API for building localization & translation systems","fork":true,"url":"https://api.github.com/repos/ta2-1/translate","forks_url":"https://api.github.com/repos/ta2-1/translate/forks","keys_url":"https://api.github.com/repos/ta2-1/translate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ta2-1/translate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ta2-1/translate/teams","hooks_url":"https://api.github.com/repos/ta2-1/translate/hooks","issue_events_url":"https://api.github.com/repos/ta2-1/translate/issues/events{/number}","events_url":"https://api.github.com/repos/ta2-1/translate/events","assignees_url":"https://api.github.com/repos/ta2-1/translate/assignees{/user}","branches_url":"https://api.github.com/repos/ta2-1/translate/branches{/branch}","tags_url":"https://api.github.com/repos/ta2-1/translate/tags","blobs_url":"https://api.github.com/repos/ta2-1/translate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ta2-1/translate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ta2-1/translate/git/refs{/sha}","trees_url":"https://api.github.com/repos/ta2-1/translate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ta2-1/translate/statuses/{sha}","languages_url":"https://api.github.com/repos/ta2-1/translate/languages","stargazers_url":"https://api.github.com/repos/ta2-1/translate/stargazers","contributors_url":"https://api.github.com/repos/ta2-1/translate/contributors","subscribers_url":"https://api.github.com/repos/ta2-1/translate/subscribers","subscription_url":"https://api.github.com/repos/ta2-1/translate/subscription","commits_url":"https://api.github.com/repos/ta2-1/translate/commits{/sha}","git_commits_url":"https://api.github.com/repos/ta2-1/translate/git/commits{/sha}","comments_url":"https://api.github.com/repos/ta2-1/translate/comments{/number}","issue_comment_url":"https://api.github.com/repos/ta2-1/translate/issues/comments{/number}","contents_url":"https://api.github.com/repos/ta2-1/translate/contents/{+path}","compare_url":"https://api.github.com/repos/ta2-1/translate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ta2-1/translate/merges","archive_url":"https://api.github.com/repos/ta2-1/translate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ta2-1/translate/downloads","issues_url":"https://api.github.com/repos/ta2-1/translate/issues{/number}","pulls_url":"https://api.github.com/repos/ta2-1/translate/pulls{/number}","milestones_url":"https://api.github.com/repos/ta2-1/translate/milestones{/number}","notifications_url":"https://api.github.com/repos/ta2-1/translate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ta2-1/translate/labels{/name}","releases_url":"https://api.github.com/repos/ta2-1/translate/releases{/id}","deployments_url":"https://api.github.com/repos/ta2-1/translate/deployments","created_at":"2016-07-08T16:36:24Z","updated_at":"2016-07-08T16:36:27Z","pushed_at":"2016-08-19T15:52:14Z","git_url":"git://github.com/ta2-1/translate.git","ssh_url":"git@github.com:ta2-1/translate.git","clone_url":"https://github.com/ta2-1/translate.git","svn_url":"https://github.com/ta2-1/translate","homepage":"http://toolkit.translatehouse.org","size":29528,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"translate:master","ref":"master","sha":"d602771c5cb4df6cf4f1b703a88261640941c74d","user":{"login":"translate","id":1538178,"avatar_url":"https://avatars.githubusercontent.com/u/1538178?v=3","gravatar_id":"","url":"https://api.github.com/users/translate","html_url":"https://github.com/translate","followers_url":"https://api.github.com/users/translate/followers","following_url":"https://api.github.com/users/translate/following{/other_user}","gists_url":"https://api.github.com/users/translate/gists{/gist_id}","starred_url":"https://api.github.com/users/translate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/translate/subscriptions","organizations_url":"https://api.github.com/users/translate/orgs","repos_url":"https://api.github.com/users/translate/repos","events_url":"https://api.github.com/users/translate/events{/privacy}","received_events_url":"https://api.github.com/users/translate/received_events","type":"Organization","site_admin":false},"repo":{"id":3769696,"name":"translate","full_name":"translate/translate","owner":{"login":"translate","id":1538178,"avatar_url":"https://avatars.githubusercontent.com/u/1538178?v=3","gravatar_id":"","url":"https://api.github.com/users/translate","html_url":"https://github.com/translate","followers_url":"https://api.github.com/users/translate/followers","following_url":"https://api.github.com/users/translate/following{/other_user}","gists_url":"https://api.github.com/users/translate/gists{/gist_id}","starred_url":"https://api.github.com/users/translate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/translate/subscriptions","organizations_url":"https://api.github.com/users/translate/orgs","repos_url":"https://api.github.com/users/translate/repos","events_url":"https://api.github.com/users/translate/events{/privacy}","received_events_url":"https://api.github.com/users/translate/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/translate/translate","description":"Useful localization tools with Python API for building localization & translation systems","fork":false,"url":"https://api.github.com/repos/translate/translate","forks_url":"https://api.github.com/repos/translate/translate/forks","keys_url":"https://api.github.com/repos/translate/translate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/translate/translate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/translate/translate/teams","hooks_url":"https://api.github.com/repos/translate/translate/hooks","issue_events_url":"https://api.github.com/repos/translate/translate/issues/events{/number}","events_url":"https://api.github.com/repos/translate/translate/events","assignees_url":"https://api.github.com/repos/translate/translate/assignees{/user}","branches_url":"https://api.github.com/repos/translate/translate/branches{/branch}","tags_url":"https://api.github.com/repos/translate/translate/tags","blobs_url":"https://api.github.com/repos/translate/translate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/translate/translate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/translate/translate/git/refs{/sha}","trees_url":"https://api.github.com/repos/translate/translate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/translate/translate/statuses/{sha}","languages_url":"https://api.github.com/repos/translate/translate/languages","stargazers_url":"https://api.github.com/repos/translate/translate/stargazers","contributors_url":"https://api.github.com/repos/translate/translate/contributors","subscribers_url":"https://api.github.com/repos/translate/translate/subscribers","subscription_url":"https://api.github.com/repos/translate/translate/subscription","commits_url":"https://api.github.com/repos/translate/translate/commits{/sha}","git_commits_url":"https://api.github.com/repos/translate/translate/git/commits{/sha}","comments_url":"https://api.github.com/repos/translate/translate/comments{/number}","issue_comment_url":"https://api.github.com/repos/translate/translate/issues/comments{/number}","contents_url":"https://api.github.com/repos/translate/translate/contents/{+path}","compare_url":"https://api.github.com/repos/translate/translate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/translate/translate/merges","archive_url":"https://api.github.com/repos/translate/translate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/translate/translate/downloads","issues_url":"https://api.github.com/repos/translate/translate/issues{/number}","pulls_url":"https://api.github.com/repos/translate/translate/pulls{/number}","milestones_url":"https://api.github.com/repos/translate/translate/milestones{/number}","notifications_url":"https://api.github.com/repos/translate/translate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/translate/translate/labels{/name}","releases_url":"https://api.github.com/repos/translate/translate/releases{/id}","deployments_url":"https://api.github.com/repos/translate/translate/deployments","created_at":"2012-03-19T23:05:29Z","updated_at":"2016-08-18T08:57:13Z","pushed_at":"2016-08-19T15:52:14Z","git_url":"git://github.com/translate/translate.git","ssh_url":"git@github.com:translate/translate.git","clone_url":"https://github.com/translate/translate.git","svn_url":"https://github.com/translate/translate","homepage":"http://toolkit.translatehouse.org","size":30023,"stargazers_count":235,"watchers_count":235,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":121,"mirror_url":null,"open_issues_count":338,"forks":121,"open_issues":338,"watchers":235,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/translate/translate/pulls/3474"},"html":{"href":"https://github.com/translate/translate/pull/3474"},"issue":{"href":"https://api.github.com/repos/translate/translate/issues/3474"},"comments":{"href":"https://api.github.com/repos/translate/translate/issues/3474/comments"},"review_comments":{"href":"https://api.github.com/repos/translate/translate/pulls/3474/comments"},"review_comment":{"href":"https://api.github.com/repos/translate/translate/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/translate/translate/pulls/3474/commits"},"statuses":{"href":"https://api.github.com/repos/translate/translate/statuses/0818785dd5b2e2d5ceef34820395a1609510f793"}}}}
{"actor":{"display_login":"unho"}}