{"action":"created","comment":{"url":"https://api.github.com/repos/meetup/meetup-web-platform/pulls/comments/93506714","pull_request_review_id":14036120,"id":93506714,"diff_hunk":"@@ -0,0 +1,47 @@\n+import url from 'url';\n+import Accepts from 'accepts';\n+\n+export const LANG_DEFAULT = 'en-US';\n+\n+export const getLanguage = (request, supportedLangs, defaultLang=LANG_DEFAULT) => {\n+\tconst firstPathComponent = request.url.path.split('/')[1];\n+\tconst urlLang = supportedLangs.includes(firstPathComponent) ? firstPathComponent : null;\n+\tconst browserLang = Accepts(request).language(supportedLangs);\n+\n+\tconst langSourcePreference = [","path":"src/util/languageUtils.js","position":11,"original_position":11,"commit_id":"f53e84c400817d52308f68e883c147e21036b4c1","original_commit_id":"f53e84c400817d52308f68e883c147e21036b4c1","user":{"login":"mmcgahan","id":1885153,"avatar_url":"https://avatars.githubusercontent.com/u/1885153?v=3","gravatar_id":"","url":"https://api.github.com/users/mmcgahan","html_url":"https://github.com/mmcgahan","followers_url":"https://api.github.com/users/mmcgahan/followers","following_url":"https://api.github.com/users/mmcgahan/following{/other_user}","gists_url":"https://api.github.com/users/mmcgahan/gists{/gist_id}","starred_url":"https://api.github.com/users/mmcgahan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmcgahan/subscriptions","organizations_url":"https://api.github.com/users/mmcgahan/orgs","repos_url":"https://api.github.com/users/mmcgahan/repos","events_url":"https://api.github.com/users/mmcgahan/events{/privacy}","received_events_url":"https://api.github.com/users/mmcgahan/received_events","type":"User","site_admin":false},"body":"yup, correct - there's a sequence of about 3-4 tasks to get this fully up to spec - member profile language support will be done in [WP-122](https://meetup.atlassian.net/browse/WP-122)","created_at":"2016-12-21T19:46:09Z","updated_at":"2016-12-21T19:46:09Z","html_url":"https://github.com/meetup/meetup-web-platform/pull/87#discussion_r93506714","pull_request_url":"https://api.github.com/repos/meetup/meetup-web-platform/pulls/87","_links":{"self":{"href":"https://api.github.com/repos/meetup/meetup-web-platform/pulls/comments/93506714"},"html":{"href":"https://github.com/meetup/meetup-web-platform/pull/87#discussion_r93506714"},"pull_request":{"href":"https://api.github.com/repos/meetup/meetup-web-platform/pulls/87"}}},"pull_request":{"url":"https://api.github.com/repos/meetup/meetup-web-platform/pulls/87","id":98401350,"html_url":"https://github.com/meetup/meetup-web-platform/pull/87","diff_url":"https://github.com/meetup/meetup-web-platform/pull/87.diff","patch_url":"https://github.com/meetup/meetup-web-platform/pull/87.patch","issue_url":"https://api.github.com/repos/meetup/meetup-web-platform/issues/87","number":87,"state":"open","locked":false,"title":"WP 119 language path prefix for routes","user":{"login":"mmcgahan","id":1885153,"avatar_url":"https://avatars.githubusercontent.com/u/1885153?v=3","gravatar_id":"","url":"https://api.github.com/users/mmcgahan","html_url":"https://github.com/mmcgahan","followers_url":"https://api.github.com/users/mmcgahan/followers","following_url":"https://api.github.com/users/mmcgahan/following{/other_user}","gists_url":"https://api.github.com/users/mmcgahan/gists{/gist_id}","starred_url":"https://api.github.com/users/mmcgahan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmcgahan/subscriptions","organizations_url":"https://api.github.com/users/mmcgahan/orgs","repos_url":"https://api.github.com/users/mmcgahan/repos","events_url":"https://api.github.com/users/mmcgahan/events{/privacy}","received_events_url":"https://api.github.com/users/mmcgahan/received_events","type":"User","site_admin":false},"body":"This PR isolates the process of determining the language of the rendered app, and adds logic to check for a language code url path prefix (e.g. `meetup.com/fr-FR/`).\r\n\r\nThe main effect of requesting the app in the non-default language is just that the app will load all static assets from the associated language, including the correct TRNs. However, it currently doesn't forward the language information to the REST API, so any strings in the API response are still un-translated. This will be fixed in a followup bug related to setting/sending language cookies (WP-124)\r\n\r\nTechnical details:\r\n\r\nIn order for the React Router routes to automatically account for the root-level URL change, we need to inject the `basename` of the URL path into the `history` consumed by the Router. The router can then read routes that are language-path-free, and `history` will automatically append the correct base path. There are a couple extra gymnastics needed to replicate this `history` behavior on the server, which doesn't have a native History API to manipulate.\r\n\r\n**BREAKING CHANGE**: new `baseUrl` argument for the renderers and a few signature changes to consume the baseUrl.","created_at":"2016-12-16T20:54:10Z","updated_at":"2016-12-21T19:46:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ee620f668fe5fb960cf0b69a4571d97cbff7b814","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/meetup/meetup-web-platform/pulls/87/commits","review_comments_url":"https://api.github.com/repos/meetup/meetup-web-platform/pulls/87/comments","review_comment_url":"https://api.github.com/repos/meetup/meetup-web-platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/meetup/meetup-web-platform/issues/87/comments","statuses_url":"https://api.github.com/repos/meetup/meetup-web-platform/statuses/f53e84c400817d52308f68e883c147e21036b4c1","head":{"label":"meetup:WP-119_lang-routes","ref":"WP-119_lang-routes","sha":"f53e84c400817d52308f68e883c147e21036b4c1","user":{"login":"meetup","id":147855,"avatar_url":"https://avatars.githubusercontent.com/u/147855?v=3","gravatar_id":"","url":"https://api.github.com/users/meetup","html_url":"https://github.com/meetup","followers_url":"https://api.github.com/users/meetup/followers","following_url":"https://api.github.com/users/meetup/following{/other_user}","gists_url":"https://api.github.com/users/meetup/gists{/gist_id}","starred_url":"https://api.github.com/users/meetup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meetup/subscriptions","organizations_url":"https://api.github.com/users/meetup/orgs","repos_url":"https://api.github.com/users/meetup/repos","events_url":"https://api.github.com/users/meetup/events{/privacy}","received_events_url":"https://api.github.com/users/meetup/received_events","type":"Organization","site_admin":false},"repo":{"id":66412742,"name":"meetup-web-platform","full_name":"meetup/meetup-web-platform","owner":{"login":"meetup","id":147855,"avatar_url":"https://avatars.githubusercontent.com/u/147855?v=3","gravatar_id":"","url":"https://api.github.com/users/meetup","html_url":"https://github.com/meetup","followers_url":"https://api.github.com/users/meetup/followers","following_url":"https://api.github.com/users/meetup/following{/other_user}","gists_url":"https://api.github.com/users/meetup/gists{/gist_id}","starred_url":"https://api.github.com/users/meetup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meetup/subscriptions","organizations_url":"https://api.github.com/users/meetup/orgs","repos_url":"https://api.github.com/users/meetup/repos","events_url":"https://api.github.com/users/meetup/events{/privacy}","received_events_url":"https://api.github.com/users/meetup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/meetup/meetup-web-platform","description":"A collection of Node web application utilities developed for the Meetup web platform","fork":false,"url":"https://api.github.com/repos/meetup/meetup-web-platform","forks_url":"https://api.github.com/repos/meetup/meetup-web-platform/forks","keys_url":"https://api.github.com/repos/meetup/meetup-web-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/meetup/meetup-web-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/meetup/meetup-web-platform/teams","hooks_url":"https://api.github.com/repos/meetup/meetup-web-platform/hooks","issue_events_url":"https://api.github.com/repos/meetup/meetup-web-platform/issues/events{/number}","events_url":"https://api.github.com/repos/meetup/meetup-web-platform/events","assignees_url":"https://api.github.com/repos/meetup/meetup-web-platform/assignees{/user}","branches_url":"https://api.github.com/repos/meetup/meetup-web-platform/branches{/branch}","tags_url":"https://api.github.com/repos/meetup/meetup-web-platform/tags","blobs_url":"https://api.github.com/repos/meetup/meetup-web-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/meetup/meetup-web-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/meetup/meetup-web-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/meetup/meetup-web-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/meetup/meetup-web-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/meetup/meetup-web-platform/languages","stargazers_url":"https://api.github.com/repos/meetup/meetup-web-platform/stargazers","contributors_url":"https://api.github.com/repos/meetup/meetup-web-platform/contributors","subscribers_url":"https://api.github.com/repos/meetup/meetup-web-platform/subscribers","subscription_url":"https://api.github.com/repos/meetup/meetup-web-platform/subscription","commits_url":"https://api.github.com/repos/meetup/meetup-web-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/meetup/meetup-web-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/meetup/meetup-web-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/meetup/meetup-web-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/meetup/meetup-web-platform/contents/{+path}","compare_url":"https://api.github.com/repos/meetup/meetup-web-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/meetup/meetup-web-platform/merges","archive_url":"https://api.github.com/repos/meetup/meetup-web-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/meetup/meetup-web-platform/downloads","issues_url":"https://api.github.com/repos/meetup/meetup-web-platform/issues{/number}","pulls_url":"https://api.github.com/repos/meetup/meetup-web-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/meetup/meetup-web-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/meetup/meetup-web-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/meetup/meetup-web-platform/labels{/name}","releases_url":"https://api.github.com/repos/meetup/meetup-web-platform/releases{/id}","deployments_url":"https://api.github.com/repos/meetup/meetup-web-platform/deployments","created_at":"2016-08-23T23:59:22Z","updated_at":"2016-11-20T23:02:42Z","pushed_at":"2016-12-21T17:24:20Z","git_url":"git://github.com/meetup/meetup-web-platform.git","ssh_url":"git@github.com:meetup/meetup-web-platform.git","clone_url":"https://github.com/meetup/meetup-web-platform.git","svn_url":"https://github.com/meetup/meetup-web-platform","homepage":null,"size":865,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":2,"forks":5,"open_issues":2,"watchers":4,"default_branch":"master"}},"base":{"label":"meetup:master","ref":"master","sha":"b77805dfc34cd4a6fe1b429274f30bd6f1f02fd7","user":{"login":"meetup","id":147855,"avatar_url":"https://avatars.githubusercontent.com/u/147855?v=3","gravatar_id":"","url":"https://api.github.com/users/meetup","html_url":"https://github.com/meetup","followers_url":"https://api.github.com/users/meetup/followers","following_url":"https://api.github.com/users/meetup/following{/other_user}","gists_url":"https://api.github.com/users/meetup/gists{/gist_id}","starred_url":"https://api.github.com/users/meetup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meetup/subscriptions","organizations_url":"https://api.github.com/users/meetup/orgs","repos_url":"https://api.github.com/users/meetup/repos","events_url":"https://api.github.com/users/meetup/events{/privacy}","received_events_url":"https://api.github.com/users/meetup/received_events","type":"Organization","site_admin":false},"repo":{"id":66412742,"name":"meetup-web-platform","full_name":"meetup/meetup-web-platform","owner":{"login":"meetup","id":147855,"avatar_url":"https://avatars.githubusercontent.com/u/147855?v=3","gravatar_id":"","url":"https://api.github.com/users/meetup","html_url":"https://github.com/meetup","followers_url":"https://api.github.com/users/meetup/followers","following_url":"https://api.github.com/users/meetup/following{/other_user}","gists_url":"https://api.github.com/users/meetup/gists{/gist_id}","starred_url":"https://api.github.com/users/meetup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meetup/subscriptions","organizations_url":"https://api.github.com/users/meetup/orgs","repos_url":"https://api.github.com/users/meetup/repos","events_url":"https://api.github.com/users/meetup/events{/privacy}","received_events_url":"https://api.github.com/users/meetup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/meetup/meetup-web-platform","description":"A collection of Node web application utilities developed for the Meetup web platform","fork":false,"url":"https://api.github.com/repos/meetup/meetup-web-platform","forks_url":"https://api.github.com/repos/meetup/meetup-web-platform/forks","keys_url":"https://api.github.com/repos/meetup/meetup-web-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/meetup/meetup-web-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/meetup/meetup-web-platform/teams","hooks_url":"https://api.github.com/repos/meetup/meetup-web-platform/hooks","issue_events_url":"https://api.github.com/repos/meetup/meetup-web-platform/issues/events{/number}","events_url":"https://api.github.com/repos/meetup/meetup-web-platform/events","assignees_url":"https://api.github.com/repos/meetup/meetup-web-platform/assignees{/user}","branches_url":"https://api.github.com/repos/meetup/meetup-web-platform/branches{/branch}","tags_url":"https://api.github.com/repos/meetup/meetup-web-platform/tags","blobs_url":"https://api.github.com/repos/meetup/meetup-web-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/meetup/meetup-web-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/meetup/meetup-web-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/meetup/meetup-web-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/meetup/meetup-web-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/meetup/meetup-web-platform/languages","stargazers_url":"https://api.github.com/repos/meetup/meetup-web-platform/stargazers","contributors_url":"https://api.github.com/repos/meetup/meetup-web-platform/contributors","subscribers_url":"https://api.github.com/repos/meetup/meetup-web-platform/subscribers","subscription_url":"https://api.github.com/repos/meetup/meetup-web-platform/subscription","commits_url":"https://api.github.com/repos/meetup/meetup-web-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/meetup/meetup-web-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/meetup/meetup-web-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/meetup/meetup-web-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/meetup/meetup-web-platform/contents/{+path}","compare_url":"https://api.github.com/repos/meetup/meetup-web-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/meetup/meetup-web-platform/merges","archive_url":"https://api.github.com/repos/meetup/meetup-web-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/meetup/meetup-web-platform/downloads","issues_url":"https://api.github.com/repos/meetup/meetup-web-platform/issues{/number}","pulls_url":"https://api.github.com/repos/meetup/meetup-web-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/meetup/meetup-web-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/meetup/meetup-web-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/meetup/meetup-web-platform/labels{/name}","releases_url":"https://api.github.com/repos/meetup/meetup-web-platform/releases{/id}","deployments_url":"https://api.github.com/repos/meetup/meetup-web-platform/deployments","created_at":"2016-08-23T23:59:22Z","updated_at":"2016-11-20T23:02:42Z","pushed_at":"2016-12-21T17:24:20Z","git_url":"git://github.com/meetup/meetup-web-platform.git","ssh_url":"git@github.com:meetup/meetup-web-platform.git","clone_url":"https://github.com/meetup/meetup-web-platform.git","svn_url":"https://github.com/meetup/meetup-web-platform","homepage":null,"size":865,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":2,"forks":5,"open_issues":2,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/meetup/meetup-web-platform/pulls/87"},"html":{"href":"https://github.com/meetup/meetup-web-platform/pull/87"},"issue":{"href":"https://api.github.com/repos/meetup/meetup-web-platform/issues/87"},"comments":{"href":"https://api.github.com/repos/meetup/meetup-web-platform/issues/87/comments"},"review_comments":{"href":"https://api.github.com/repos/meetup/meetup-web-platform/pulls/87/comments"},"review_comment":{"href":"https://api.github.com/repos/meetup/meetup-web-platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/meetup/meetup-web-platform/pulls/87/commits"},"statuses":{"href":"https://api.github.com/repos/meetup/meetup-web-platform/statuses/f53e84c400817d52308f68e883c147e21036b4c1"}}}}
{"actor":{"display_login":"mmcgahan"}}