{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/loop-client/pulls/comments/22797689","id":22797689,"diff_hunk":"@@ -0,0 +1,65 @@\n+#!/usr/bin/python\n+\n+##\n+# This script is designed to update the l10n files and locale registration\n+# for the standalone loop client. The source of the localization files\n+# is https://github.com/mozilla/loop-client-l10n repository.\n+# The loop client repo is assumed to be https://github.com/mozilla/loop-client.\n+#\n+# Run this script from the local version of loop-client. It assumes that a local\n+# version of loop-client-l10n is in a parallel directory: ../loop-client-l10n.\n+# Changes are then pushed back to loop-client.\n+##\n+\n+import argparse\n+import io\n+import os\n+import re\n+import shutil\n+import sys\n+\n+def main(l10n_src, l10n_dst, index_file_name):\n+    print \"deleting existing l10n content tree:\", l10n_dst\n+    shutil.rmtree(l10n_dst, ignore_errors=True)\n+\n+    print \"updating l10n tree from\", l10n_src\n+\n+    def create_locale(src_dir):\n+        dst_dir = src_dir.replace('_', '-')\n+        shutil.copytree(os.path.join(l10n_src, src_dir), os.path.join(l10n_dst, dst_dir))\n+        return dst_dir\n+    \n+    locale_dirs = os.listdir(l10n_src)\n+    locale_list = [create_locale(x) for x in locale_dirs if x[0] != \".\" and x != \"templates\"]\n+\n+    print \"updating locales list in\", index_file_name\n+    with io.open(index_file_name, \"r+\") as index_file:\n+        index_html = index_file.read()\n+\n+        new_content = re.sub(\n+            '<meta name=([\"|\\'])locales\\\\1.*? content=([\"|\\']).*?\\\\2.*? />',\n+            '<meta name=\"locales\" content=\"' + \", \".join(locale_list) + '\" />',\n+            index_html, 1, re.M | re.S)\n+        \n+        index_file.seek(0)\n+        index_file.truncate(0)\n+        index_file.write(new_content)\n+\n+if __name__ == \"__main__\":\n+    parser = argparse.ArgumentParser(\n+        description=\"Loop Stand-alone Client localization update script\")\n+    parser.add_argument('--src',\n+                        default=os.path.join(os.pardir, \"loop-client-l10n\", \"l10n\"),\n+                        metavar=\"path\",\n+                        help=\"source path for l10n resources\")","path":"locale_update.py","position":54,"original_position":54,"commit_id":"d0c56dc55dfdbca91f9c42bf75d03d285c0557e8","original_commit_id":"d0c56dc55dfdbca91f9c42bf75d03d285c0557e8","user":{"login":"ametaireau","id":67073,"avatar_url":"https://avatars.githubusercontent.com/u/67073?v=3","gravatar_id":"","url":"https://api.github.com/users/ametaireau","html_url":"https://github.com/ametaireau","followers_url":"https://api.github.com/users/ametaireau/followers","following_url":"https://api.github.com/users/ametaireau/following{/other_user}","gists_url":"https://api.github.com/users/ametaireau/gists{/gist_id}","starred_url":"https://api.github.com/users/ametaireau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ametaireau/subscriptions","organizations_url":"https://api.github.com/users/ametaireau/orgs","repos_url":"https://api.github.com/users/ametaireau/repos","events_url":"https://api.github.com/users/ametaireau/events{/privacy}","received_events_url":"https://api.github.com/users/ametaireau/received_events","type":"User","site_admin":false},"body":"I believe it will show up directly from the default argument.","created_at":"2015-01-12T15:42:16Z","updated_at":"2015-01-12T15:42:16Z","html_url":"https://github.com/mozilla/loop-client/pull/47#discussion_r22797689","pull_request_url":"https://api.github.com/repos/mozilla/loop-client/pulls/47","_links":{"self":{"href":"https://api.github.com/repos/mozilla/loop-client/pulls/comments/22797689"},"html":{"href":"https://github.com/mozilla/loop-client/pull/47#discussion_r22797689"},"pull_request":{"href":"https://api.github.com/repos/mozilla/loop-client/pulls/47"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/loop-client/pulls/47","id":26908268,"html_url":"https://github.com/mozilla/loop-client/pull/47","diff_url":"https://github.com/mozilla/loop-client/pull/47.diff","patch_url":"https://github.com/mozilla/loop-client/pull/47.patch","issue_url":"https://api.github.com/repos/mozilla/loop-client/issues/47","number":47,"state":"open","locked":false,"title":"Bug 1000269 - Add python script to move locale files into the loop-client tree,","user":{"login":"PauKerr","id":8901328,"avatar_url":"https://avatars.githubusercontent.com/u/8901328?v=3","gravatar_id":"","url":"https://api.github.com/users/PauKerr","html_url":"https://github.com/PauKerr","followers_url":"https://api.github.com/users/PauKerr/followers","following_url":"https://api.github.com/users/PauKerr/following{/other_user}","gists_url":"https://api.github.com/users/PauKerr/gists{/gist_id}","starred_url":"https://api.github.com/users/PauKerr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PauKerr/subscriptions","organizations_url":"https://api.github.com/users/PauKerr/orgs","repos_url":"https://api.github.com/users/PauKerr/repos","events_url":"https://api.github.com/users/PauKerr/events{/privacy}","received_events_url":"https://api.github.com/users/PauKerr/received_events","type":"User","site_admin":false},"body":"changing any '_' to '-' in the directory name and finally generating\r\na locales list to be inserted in index.html.","created_at":"2015-01-06T18:41:06Z","updated_at":"2015-01-12T15:42:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"54787495b78386533023dd9c9976904dc89665d7","assignee":{"login":"Standard8","id":520844,"avatar_url":"https://avatars.githubusercontent.com/u/520844?v=3","gravatar_id":"","url":"https://api.github.com/users/Standard8","html_url":"https://github.com/Standard8","followers_url":"https://api.github.com/users/Standard8/followers","following_url":"https://api.github.com/users/Standard8/following{/other_user}","gists_url":"https://api.github.com/users/Standard8/gists{/gist_id}","starred_url":"https://api.github.com/users/Standard8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Standard8/subscriptions","organizations_url":"https://api.github.com/users/Standard8/orgs","repos_url":"https://api.github.com/users/Standard8/repos","events_url":"https://api.github.com/users/Standard8/events{/privacy}","received_events_url":"https://api.github.com/users/Standard8/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/loop-client/pulls/47/commits","review_comments_url":"https://api.github.com/repos/mozilla/loop-client/pulls/47/comments","review_comment_url":"https://api.github.com/repos/mozilla/loop-client/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mozilla/loop-client/issues/47/comments","statuses_url":"https://api.github.com/repos/mozilla/loop-client/statuses/d0c56dc55dfdbca91f9c42bf75d03d285c0557e8","head":{"label":"mozilla:bug-1000269-l10n-process","ref":"bug-1000269-l10n-process","sha":"d0c56dc55dfdbca91f9c42bf75d03d285c0557e8","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":17837818,"name":"loop-client","full_name":"mozilla/loop-client","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/loop-client","description":"The mozilla loop client - THIS IS CURRENTLY ONLY USED FOR RELEASES. mozilla-central (browser/components/loop/standalone)  is the authoritive branch for the previous loop-client","fork":false,"url":"https://api.github.com/repos/mozilla/loop-client","forks_url":"https://api.github.com/repos/mozilla/loop-client/forks","keys_url":"https://api.github.com/repos/mozilla/loop-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/loop-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/loop-client/teams","hooks_url":"https://api.github.com/repos/mozilla/loop-client/hooks","issue_events_url":"https://api.github.com/repos/mozilla/loop-client/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/loop-client/events","assignees_url":"https://api.github.com/repos/mozilla/loop-client/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/loop-client/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/loop-client/tags","blobs_url":"https://api.github.com/repos/mozilla/loop-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/loop-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/loop-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/loop-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/loop-client/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/loop-client/languages","stargazers_url":"https://api.github.com/repos/mozilla/loop-client/stargazers","contributors_url":"https://api.github.com/repos/mozilla/loop-client/contributors","subscribers_url":"https://api.github.com/repos/mozilla/loop-client/subscribers","subscription_url":"https://api.github.com/repos/mozilla/loop-client/subscription","commits_url":"https://api.github.com/repos/mozilla/loop-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/loop-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/loop-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/loop-client/issues/comments/{number}","contents_url":"https://api.github.com/repos/mozilla/loop-client/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/loop-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/loop-client/merges","archive_url":"https://api.github.com/repos/mozilla/loop-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/loop-client/downloads","issues_url":"https://api.github.com/repos/mozilla/loop-client/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/loop-client/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/loop-client/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/loop-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/loop-client/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/loop-client/releases{/id}","created_at":"2014-03-17T17:58:54Z","updated_at":"2015-01-12T13:00:15Z","pushed_at":"2015-01-12T13:00:15Z","git_url":"git://github.com/mozilla/loop-client.git","ssh_url":"git@github.com:mozilla/loop-client.git","clone_url":"https://github.com/mozilla/loop-client.git","svn_url":"https://github.com/mozilla/loop-client","homepage":"https://tbpl.mozilla.org/","size":6334,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":2,"forks":4,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"f0190803f511fc4f03d8c4c9d2377b417aee958f","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":17837818,"name":"loop-client","full_name":"mozilla/loop-client","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/loop-client","description":"The mozilla loop client - THIS IS CURRENTLY ONLY USED FOR RELEASES. mozilla-central (browser/components/loop/standalone)  is the authoritive branch for the previous loop-client","fork":false,"url":"https://api.github.com/repos/mozilla/loop-client","forks_url":"https://api.github.com/repos/mozilla/loop-client/forks","keys_url":"https://api.github.com/repos/mozilla/loop-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/loop-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/loop-client/teams","hooks_url":"https://api.github.com/repos/mozilla/loop-client/hooks","issue_events_url":"https://api.github.com/repos/mozilla/loop-client/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/loop-client/events","assignees_url":"https://api.github.com/repos/mozilla/loop-client/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/loop-client/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/loop-client/tags","blobs_url":"https://api.github.com/repos/mozilla/loop-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/loop-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/loop-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/loop-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/loop-client/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/loop-client/languages","stargazers_url":"https://api.github.com/repos/mozilla/loop-client/stargazers","contributors_url":"https://api.github.com/repos/mozilla/loop-client/contributors","subscribers_url":"https://api.github.com/repos/mozilla/loop-client/subscribers","subscription_url":"https://api.github.com/repos/mozilla/loop-client/subscription","commits_url":"https://api.github.com/repos/mozilla/loop-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/loop-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/loop-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/loop-client/issues/comments/{number}","contents_url":"https://api.github.com/repos/mozilla/loop-client/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/loop-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/loop-client/merges","archive_url":"https://api.github.com/repos/mozilla/loop-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/loop-client/downloads","issues_url":"https://api.github.com/repos/mozilla/loop-client/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/loop-client/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/loop-client/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/loop-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/loop-client/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/loop-client/releases{/id}","created_at":"2014-03-17T17:58:54Z","updated_at":"2015-01-12T13:00:15Z","pushed_at":"2015-01-12T13:00:15Z","git_url":"git://github.com/mozilla/loop-client.git","ssh_url":"git@github.com:mozilla/loop-client.git","clone_url":"https://github.com/mozilla/loop-client.git","svn_url":"https://github.com/mozilla/loop-client","homepage":"https://tbpl.mozilla.org/","size":6334,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":2,"forks":4,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/loop-client/pulls/47"},"html":{"href":"https://github.com/mozilla/loop-client/pull/47"},"issue":{"href":"https://api.github.com/repos/mozilla/loop-client/issues/47"},"comments":{"href":"https://api.github.com/repos/mozilla/loop-client/issues/47/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/loop-client/pulls/47/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/loop-client/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mozilla/loop-client/pulls/47/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/loop-client/statuses/d0c56dc55dfdbca91f9c42bf75d03d285c0557e8"}}}}