{"action":"created","comment":{"url":"https://api.github.com/repos/GovLab/noi2/pulls/comments/42062616","id":42062616,"diff_hunk":"@@ -0,0 +1,12 @@\n+from flask import request\n+\n+import os\n+\n+TRANSLATIONS = ['en'] + os.listdir('/noi/app/translations')","path":"app/l10n.py","position":5,"original_position":5,"commit_id":"6a98992a875718f63e667b70a3c0301f745a5e29","original_commit_id":"6a98992a875718f63e667b70a3c0301f745a5e29","user":{"login":"toolness","id":124687,"avatar_url":"https://avatars.githubusercontent.com/u/124687?v=3","gravatar_id":"","url":"https://api.github.com/users/toolness","html_url":"https://github.com/toolness","followers_url":"https://api.github.com/users/toolness/followers","following_url":"https://api.github.com/users/toolness/following{/other_user}","gists_url":"https://api.github.com/users/toolness/gists{/gist_id}","starred_url":"https://api.github.com/users/toolness/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toolness/subscriptions","organizations_url":"https://api.github.com/users/toolness/orgs","repos_url":"https://api.github.com/users/toolness/repos","events_url":"https://api.github.com/users/toolness/events{/privacy}","received_events_url":"https://api.github.com/users/toolness/received_events","type":"User","site_admin":false},"body":"errr, I'm doing this by listing the `translations` directory, but maybe I should be looking in the deployment config instead?","created_at":"2015-10-14T22:31:20Z","updated_at":"2015-10-14T22:31:20Z","html_url":"https://github.com/GovLab/noi2/pull/151#discussion_r42062616","pull_request_url":"https://api.github.com/repos/GovLab/noi2/pulls/151","_links":{"self":{"href":"https://api.github.com/repos/GovLab/noi2/pulls/comments/42062616"},"html":{"href":"https://github.com/GovLab/noi2/pull/151#discussion_r42062616"},"pull_request":{"href":"https://api.github.com/repos/GovLab/noi2/pulls/151"}}},"pull_request":{"url":"https://api.github.com/repos/GovLab/noi2/pulls/151","id":47723383,"html_url":"https://github.com/GovLab/noi2/pull/151","diff_url":"https://github.com/GovLab/noi2/pull/151.diff","patch_url":"https://github.com/GovLab/noi2/pull/151.patch","issue_url":"https://api.github.com/repos/GovLab/noi2/issues/151","number":151,"state":"open","locked":false,"title":"Add a basic babel localeselector","user":{"login":"toolness","id":124687,"avatar_url":"https://avatars.githubusercontent.com/u/124687?v=3","gravatar_id":"","url":"https://api.github.com/users/toolness","html_url":"https://github.com/toolness","followers_url":"https://api.github.com/users/toolness/followers","following_url":"https://api.github.com/users/toolness/following{/other_user}","gists_url":"https://api.github.com/users/toolness/gists{/gist_id}","starred_url":"https://api.github.com/users/toolness/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toolness/subscriptions","organizations_url":"https://api.github.com/users/toolness/orgs","repos_url":"https://api.github.com/users/toolness/repos","events_url":"https://api.github.com/users/toolness/events{/privacy}","received_events_url":"https://api.github.com/users/toolness/received_events","type":"User","site_admin":false},"body":"This lays a foundation for fixing #148 (and partially fixes it) by adding a simple [Babel `localeselector`](https://pythonhosted.org/Flask-Babel/#flask.ext.babel.Babel.localeselector) for the app that just compares the request's `Accept-Languages` header to the available translations.\r\n\r\nThis can be manually tested by using Firefox and going to \"Options -> Content -> Languages -> Choose...\" and adding \"Spanish / Mexico [es-mx]\" to the top of the list, and then reloading any page on the site, the language of which should change to Spanish. (Unfortunately, this is hard to do in other browsers because they don't seem to support explicitly setting es-mx.)\r\n\r\nIn the future, we can add some code to the `localeselector` that inspects the user's session and/or profile to choose a better language.\r\n","created_at":"2015-10-14T22:28:13Z","updated_at":"2015-10-14T22:31:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"23f0c435a2716bd4adddb4576f4563bdf9f85ede","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/GovLab/noi2/pulls/151/commits","review_comments_url":"https://api.github.com/repos/GovLab/noi2/pulls/151/comments","review_comment_url":"https://api.github.com/repos/GovLab/noi2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GovLab/noi2/issues/151/comments","statuses_url":"https://api.github.com/repos/GovLab/noi2/statuses/6a98992a875718f63e667b70a3c0301f745a5e29","head":{"label":"GovLab:babel-localeselector","ref":"babel-localeselector","sha":"6a98992a875718f63e667b70a3c0301f745a5e29","user":{"login":"GovLab","id":4174904,"avatar_url":"https://avatars.githubusercontent.com/u/4174904?v=3","gravatar_id":"","url":"https://api.github.com/users/GovLab","html_url":"https://github.com/GovLab","followers_url":"https://api.github.com/users/GovLab/followers","following_url":"https://api.github.com/users/GovLab/following{/other_user}","gists_url":"https://api.github.com/users/GovLab/gists{/gist_id}","starred_url":"https://api.github.com/users/GovLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GovLab/subscriptions","organizations_url":"https://api.github.com/users/GovLab/orgs","repos_url":"https://api.github.com/users/GovLab/repos","events_url":"https://api.github.com/users/GovLab/events{/privacy}","received_events_url":"https://api.github.com/users/GovLab/received_events","type":"Organization","site_admin":false},"repo":{"id":40134662,"name":"noi2","full_name":"GovLab/noi2","owner":{"login":"GovLab","id":4174904,"avatar_url":"https://avatars.githubusercontent.com/u/4174904?v=3","gravatar_id":"","url":"https://api.github.com/users/GovLab","html_url":"https://github.com/GovLab","followers_url":"https://api.github.com/users/GovLab/followers","following_url":"https://api.github.com/users/GovLab/following{/other_user}","gists_url":"https://api.github.com/users/GovLab/gists{/gist_id}","starred_url":"https://api.github.com/users/GovLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GovLab/subscriptions","organizations_url":"https://api.github.com/users/GovLab/orgs","repos_url":"https://api.github.com/users/GovLab/repos","events_url":"https://api.github.com/users/GovLab/events{/privacy}","received_events_url":"https://api.github.com/users/GovLab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GovLab/noi2","description":"","fork":false,"url":"https://api.github.com/repos/GovLab/noi2","forks_url":"https://api.github.com/repos/GovLab/noi2/forks","keys_url":"https://api.github.com/repos/GovLab/noi2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GovLab/noi2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GovLab/noi2/teams","hooks_url":"https://api.github.com/repos/GovLab/noi2/hooks","issue_events_url":"https://api.github.com/repos/GovLab/noi2/issues/events{/number}","events_url":"https://api.github.com/repos/GovLab/noi2/events","assignees_url":"https://api.github.com/repos/GovLab/noi2/assignees{/user}","branches_url":"https://api.github.com/repos/GovLab/noi2/branches{/branch}","tags_url":"https://api.github.com/repos/GovLab/noi2/tags","blobs_url":"https://api.github.com/repos/GovLab/noi2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GovLab/noi2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GovLab/noi2/git/refs{/sha}","trees_url":"https://api.github.com/repos/GovLab/noi2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GovLab/noi2/statuses/{sha}","languages_url":"https://api.github.com/repos/GovLab/noi2/languages","stargazers_url":"https://api.github.com/repos/GovLab/noi2/stargazers","contributors_url":"https://api.github.com/repos/GovLab/noi2/contributors","subscribers_url":"https://api.github.com/repos/GovLab/noi2/subscribers","subscription_url":"https://api.github.com/repos/GovLab/noi2/subscription","commits_url":"https://api.github.com/repos/GovLab/noi2/commits{/sha}","git_commits_url":"https://api.github.com/repos/GovLab/noi2/git/commits{/sha}","comments_url":"https://api.github.com/repos/GovLab/noi2/comments{/number}","issue_comment_url":"https://api.github.com/repos/GovLab/noi2/issues/comments{/number}","contents_url":"https://api.github.com/repos/GovLab/noi2/contents/{+path}","compare_url":"https://api.github.com/repos/GovLab/noi2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GovLab/noi2/merges","archive_url":"https://api.github.com/repos/GovLab/noi2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GovLab/noi2/downloads","issues_url":"https://api.github.com/repos/GovLab/noi2/issues{/number}","pulls_url":"https://api.github.com/repos/GovLab/noi2/pulls{/number}","milestones_url":"https://api.github.com/repos/GovLab/noi2/milestones{/number}","notifications_url":"https://api.github.com/repos/GovLab/noi2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GovLab/noi2/labels{/name}","releases_url":"https://api.github.com/repos/GovLab/noi2/releases{/id}","created_at":"2015-08-03T16:10:41Z","updated_at":"2015-10-14T14:06:47Z","pushed_at":"2015-10-14T22:28:13Z","git_url":"git://github.com/GovLab/noi2.git","ssh_url":"git@github.com:GovLab/noi2.git","clone_url":"https://github.com/GovLab/noi2.git","svn_url":"https://github.com/GovLab/noi2","homepage":null,"size":5454,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":28,"forks":5,"open_issues":28,"watchers":0,"default_branch":"master"}},"base":{"label":"GovLab:master","ref":"master","sha":"bad4ae49994d312f261f4fa8acc5590ca7f89f31","user":{"login":"GovLab","id":4174904,"avatar_url":"https://avatars.githubusercontent.com/u/4174904?v=3","gravatar_id":"","url":"https://api.github.com/users/GovLab","html_url":"https://github.com/GovLab","followers_url":"https://api.github.com/users/GovLab/followers","following_url":"https://api.github.com/users/GovLab/following{/other_user}","gists_url":"https://api.github.com/users/GovLab/gists{/gist_id}","starred_url":"https://api.github.com/users/GovLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GovLab/subscriptions","organizations_url":"https://api.github.com/users/GovLab/orgs","repos_url":"https://api.github.com/users/GovLab/repos","events_url":"https://api.github.com/users/GovLab/events{/privacy}","received_events_url":"https://api.github.com/users/GovLab/received_events","type":"Organization","site_admin":false},"repo":{"id":40134662,"name":"noi2","full_name":"GovLab/noi2","owner":{"login":"GovLab","id":4174904,"avatar_url":"https://avatars.githubusercontent.com/u/4174904?v=3","gravatar_id":"","url":"https://api.github.com/users/GovLab","html_url":"https://github.com/GovLab","followers_url":"https://api.github.com/users/GovLab/followers","following_url":"https://api.github.com/users/GovLab/following{/other_user}","gists_url":"https://api.github.com/users/GovLab/gists{/gist_id}","starred_url":"https://api.github.com/users/GovLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GovLab/subscriptions","organizations_url":"https://api.github.com/users/GovLab/orgs","repos_url":"https://api.github.com/users/GovLab/repos","events_url":"https://api.github.com/users/GovLab/events{/privacy}","received_events_url":"https://api.github.com/users/GovLab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GovLab/noi2","description":"","fork":false,"url":"https://api.github.com/repos/GovLab/noi2","forks_url":"https://api.github.com/repos/GovLab/noi2/forks","keys_url":"https://api.github.com/repos/GovLab/noi2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GovLab/noi2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GovLab/noi2/teams","hooks_url":"https://api.github.com/repos/GovLab/noi2/hooks","issue_events_url":"https://api.github.com/repos/GovLab/noi2/issues/events{/number}","events_url":"https://api.github.com/repos/GovLab/noi2/events","assignees_url":"https://api.github.com/repos/GovLab/noi2/assignees{/user}","branches_url":"https://api.github.com/repos/GovLab/noi2/branches{/branch}","tags_url":"https://api.github.com/repos/GovLab/noi2/tags","blobs_url":"https://api.github.com/repos/GovLab/noi2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GovLab/noi2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GovLab/noi2/git/refs{/sha}","trees_url":"https://api.github.com/repos/GovLab/noi2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GovLab/noi2/statuses/{sha}","languages_url":"https://api.github.com/repos/GovLab/noi2/languages","stargazers_url":"https://api.github.com/repos/GovLab/noi2/stargazers","contributors_url":"https://api.github.com/repos/GovLab/noi2/contributors","subscribers_url":"https://api.github.com/repos/GovLab/noi2/subscribers","subscription_url":"https://api.github.com/repos/GovLab/noi2/subscription","commits_url":"https://api.github.com/repos/GovLab/noi2/commits{/sha}","git_commits_url":"https://api.github.com/repos/GovLab/noi2/git/commits{/sha}","comments_url":"https://api.github.com/repos/GovLab/noi2/comments{/number}","issue_comment_url":"https://api.github.com/repos/GovLab/noi2/issues/comments{/number}","contents_url":"https://api.github.com/repos/GovLab/noi2/contents/{+path}","compare_url":"https://api.github.com/repos/GovLab/noi2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GovLab/noi2/merges","archive_url":"https://api.github.com/repos/GovLab/noi2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GovLab/noi2/downloads","issues_url":"https://api.github.com/repos/GovLab/noi2/issues{/number}","pulls_url":"https://api.github.com/repos/GovLab/noi2/pulls{/number}","milestones_url":"https://api.github.com/repos/GovLab/noi2/milestones{/number}","notifications_url":"https://api.github.com/repos/GovLab/noi2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GovLab/noi2/labels{/name}","releases_url":"https://api.github.com/repos/GovLab/noi2/releases{/id}","created_at":"2015-08-03T16:10:41Z","updated_at":"2015-10-14T14:06:47Z","pushed_at":"2015-10-14T22:28:13Z","git_url":"git://github.com/GovLab/noi2.git","ssh_url":"git@github.com:GovLab/noi2.git","clone_url":"https://github.com/GovLab/noi2.git","svn_url":"https://github.com/GovLab/noi2","homepage":null,"size":5454,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":28,"forks":5,"open_issues":28,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GovLab/noi2/pulls/151"},"html":{"href":"https://github.com/GovLab/noi2/pull/151"},"issue":{"href":"https://api.github.com/repos/GovLab/noi2/issues/151"},"comments":{"href":"https://api.github.com/repos/GovLab/noi2/issues/151/comments"},"review_comments":{"href":"https://api.github.com/repos/GovLab/noi2/pulls/151/comments"},"review_comment":{"href":"https://api.github.com/repos/GovLab/noi2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GovLab/noi2/pulls/151/commits"},"statuses":{"href":"https://api.github.com/repos/GovLab/noi2/statuses/6a98992a875718f63e667b70a3c0301f745a5e29"}}}}