{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/comments/201172067","pull_request_review_id":135621330,"id":201172067,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMTE3MjA2Nw==","diff_hunk":"@@ -0,0 +1,78 @@\n+/**\n+ * @license Copyright 2018 Google Inc. All Rights Reserved.\n+ * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n+ */\n+'use strict';\n+\n+const path = require('path');\n+const MessageFormat = require('intl-messageformat').default;\n+const MessageParser = require('intl-messageformat-parser');\n+const LOCALES = require('./locales');\n+\n+let locale = MessageFormat.defaultLocale;\n+\n+const LH_ROOT = path.join(__dirname, '../../');\n+\n+try {\n+  // Node usually doesn't come with the locales we want built-in so we'll use the polyfill anyway\n+\n+  // @ts-ignore\n+  require('intl');\n+  // @ts-ignore\n+  Intl.NumberFormat   = IntlPolyfill.NumberFormat;\n+  // @ts-ignore\n+  Intl.DateTimeFormat = IntlPolyfill.DateTimeFormat;\n+} catch (_) {}\n+\n+const UI_STRINGS = {\n+  ms: '{timeInMs, number, milliseconds} ms',\n+  columnURL: 'URL',\n+  columnSize: 'Size (KB)',\n+  columnWastedTime: 'Potential Savings (ms)',\n+};\n+\n+const formats = {\n+  number: {\n+    milliseconds: {\n+      maximumFractionDigits: 0,\n+      maximumSignificantDigits: 2,\n+    },\n+    seconds: {},\n+    bytes: {},\n+  },\n+};\n+\n+module.exports = {\n+  UI_STRINGS,\n+  /**\n+   * @param {string} filename\n+   * @param {Record<string, string>} localStrings\n+   */\n+  createStringFormatter(filename, localStrings) {\n+    const mergedStrings = {...UI_STRINGS, ...localStrings};\n+    /** @param {string} msg @param {*} [values] */\n+    const format = (msg, values) => {\n+      const keyname = Object.keys(mergedStrings).find(key => mergedStrings[key] === msg);\n+      if (!keyname) throw new Error(`Could not locate: ${msg}`);\n+\n+      const parsed = MessageParser.parse(msg);\n+      parsed.elements","path":"lighthouse-core/lib/i18n.js","position":60,"original_position":60,"commit_id":"9032e64ddcd6879f9fe2835c3a2cd82ce79050cb","original_commit_id":"9032e64ddcd6879f9fe2835c3a2cd82ce79050cb","user":{"login":"patrickhulce","id":2301202,"node_id":"MDQ6VXNlcjIzMDEyMDI=","avatar_url":"https://avatars2.githubusercontent.com/u/2301202?v=4","gravatar_id":"","url":"https://api.github.com/users/patrickhulce","html_url":"https://github.com/patrickhulce","followers_url":"https://api.github.com/users/patrickhulce/followers","following_url":"https://api.github.com/users/patrickhulce/following{/other_user}","gists_url":"https://api.github.com/users/patrickhulce/gists{/gist_id}","starred_url":"https://api.github.com/users/patrickhulce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrickhulce/subscriptions","organizations_url":"https://api.github.com/users/patrickhulce/orgs","repos_url":"https://api.github.com/users/patrickhulce/repos","events_url":"https://api.github.com/users/patrickhulce/events{/privacy}","received_events_url":"https://api.github.com/users/patrickhulce/received_events","type":"User","site_admin":false},"body":"by forcing the use of our own format function first, we can do things like preserve our fancy rounding logic for milliseconds, automatically convert bytes to KB, etc.","created_at":"2018-07-09T22:52:25Z","updated_at":"2018-07-09T22:53:26Z","html_url":"https://github.com/GoogleChrome/lighthouse/pull/5644#discussion_r201172067","pull_request_url":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/5644","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/comments/201172067"},"html":{"href":"https://github.com/GoogleChrome/lighthouse/pull/5644#discussion_r201172067"},"pull_request":{"href":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/5644"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/5644","id":200240345,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAwMjQwMzQ1","html_url":"https://github.com/GoogleChrome/lighthouse/pull/5644","diff_url":"https://github.com/GoogleChrome/lighthouse/pull/5644.diff","patch_url":"https://github.com/GoogleChrome/lighthouse/pull/5644.patch","issue_url":"https://api.github.com/repos/GoogleChrome/lighthouse/issues/5644","number":5644,"state":"open","locked":false,"title":"[WIP] core: i18n spike","user":{"login":"patrickhulce","id":2301202,"node_id":"MDQ6VXNlcjIzMDEyMDI=","avatar_url":"https://avatars2.githubusercontent.com/u/2301202?v=4","gravatar_id":"","url":"https://api.github.com/users/patrickhulce","html_url":"https://github.com/patrickhulce","followers_url":"https://api.github.com/users/patrickhulce/followers","following_url":"https://api.github.com/users/patrickhulce/following{/other_user}","gists_url":"https://api.github.com/users/patrickhulce/gists{/gist_id}","starred_url":"https://api.github.com/users/patrickhulce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrickhulce/subscriptions","organizations_url":"https://api.github.com/users/patrickhulce/orgs","repos_url":"https://api.github.com/users/patrickhulce/repos","events_url":"https://api.github.com/users/patrickhulce/events{/privacy}","received_events_url":"https://api.github.com/users/patrickhulce/received_events","type":"User","site_admin":false},"body":"a slightly different take on the dynamic approach we ditched earlier.\r\n\r\nI wanted to pitch this one more time because I ran into 2 issues that felt 😝 ","created_at":"2018-07-09T22:50:31Z","updated_at":"2018-07-09T22:53:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[{"login":"paulirish","id":39191,"node_id":"MDQ6VXNlcjM5MTkx","avatar_url":"https://avatars0.githubusercontent.com/u/39191?v=4","gravatar_id":"","url":"https://api.github.com/users/paulirish","html_url":"https://github.com/paulirish","followers_url":"https://api.github.com/users/paulirish/followers","following_url":"https://api.github.com/users/paulirish/following{/other_user}","gists_url":"https://api.github.com/users/paulirish/gists{/gist_id}","starred_url":"https://api.github.com/users/paulirish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulirish/subscriptions","organizations_url":"https://api.github.com/users/paulirish/orgs","repos_url":"https://api.github.com/users/paulirish/repos","events_url":"https://api.github.com/users/paulirish/events{/privacy}","received_events_url":"https://api.github.com/users/paulirish/received_events","type":"User","site_admin":false},{"login":"brendankenny","id":316891,"node_id":"MDQ6VXNlcjMxNjg5MQ==","avatar_url":"https://avatars3.githubusercontent.com/u/316891?v=4","gravatar_id":"","url":"https://api.github.com/users/brendankenny","html_url":"https://github.com/brendankenny","followers_url":"https://api.github.com/users/brendankenny/followers","following_url":"https://api.github.com/users/brendankenny/following{/other_user}","gists_url":"https://api.github.com/users/brendankenny/gists{/gist_id}","starred_url":"https://api.github.com/users/brendankenny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendankenny/subscriptions","organizations_url":"https://api.github.com/users/brendankenny/orgs","repos_url":"https://api.github.com/users/brendankenny/repos","events_url":"https://api.github.com/users/brendankenny/events{/privacy}","received_events_url":"https://api.github.com/users/brendankenny/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/5644/commits","review_comments_url":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/5644/comments","review_comment_url":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleChrome/lighthouse/issues/5644/comments","statuses_url":"https://api.github.com/repos/GoogleChrome/lighthouse/statuses/9032e64ddcd6879f9fe2835c3a2cd82ce79050cb","head":{"label":"GoogleChrome:i18n_spike","ref":"i18n_spike","sha":"9032e64ddcd6879f9fe2835c3a2cd82ce79050cb","user":{"login":"GoogleChrome","id":1778935,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3Nzg5MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/1778935?v=4","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"repo":{"id":53370988,"node_id":"MDEwOlJlcG9zaXRvcnk1MzM3MDk4OA==","name":"lighthouse","full_name":"GoogleChrome/lighthouse","owner":{"login":"GoogleChrome","id":1778935,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3Nzg5MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/1778935?v=4","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleChrome/lighthouse","description":"Auditing, performance metrics, and best practices for Progressive Web Apps","fork":false,"url":"https://api.github.com/repos/GoogleChrome/lighthouse","forks_url":"https://api.github.com/repos/GoogleChrome/lighthouse/forks","keys_url":"https://api.github.com/repos/GoogleChrome/lighthouse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleChrome/lighthouse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleChrome/lighthouse/teams","hooks_url":"https://api.github.com/repos/GoogleChrome/lighthouse/hooks","issue_events_url":"https://api.github.com/repos/GoogleChrome/lighthouse/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleChrome/lighthouse/events","assignees_url":"https://api.github.com/repos/GoogleChrome/lighthouse/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleChrome/lighthouse/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleChrome/lighthouse/tags","blobs_url":"https://api.github.com/repos/GoogleChrome/lighthouse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleChrome/lighthouse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleChrome/lighthouse/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleChrome/lighthouse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleChrome/lighthouse/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleChrome/lighthouse/languages","stargazers_url":"https://api.github.com/repos/GoogleChrome/lighthouse/stargazers","contributors_url":"https://api.github.com/repos/GoogleChrome/lighthouse/contributors","subscribers_url":"https://api.github.com/repos/GoogleChrome/lighthouse/subscribers","subscription_url":"https://api.github.com/repos/GoogleChrome/lighthouse/subscription","commits_url":"https://api.github.com/repos/GoogleChrome/lighthouse/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleChrome/lighthouse/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleChrome/lighthouse/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleChrome/lighthouse/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleChrome/lighthouse/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleChrome/lighthouse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleChrome/lighthouse/merges","archive_url":"https://api.github.com/repos/GoogleChrome/lighthouse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleChrome/lighthouse/downloads","issues_url":"https://api.github.com/repos/GoogleChrome/lighthouse/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleChrome/lighthouse/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleChrome/lighthouse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleChrome/lighthouse/labels{/name}","releases_url":"https://api.github.com/repos/GoogleChrome/lighthouse/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleChrome/lighthouse/deployments","created_at":"2016-03-08T01:03:11Z","updated_at":"2018-07-09T20:00:54Z","pushed_at":"2018-07-09T22:50:32Z","git_url":"git://github.com/GoogleChrome/lighthouse.git","ssh_url":"git@github.com:GoogleChrome/lighthouse.git","clone_url":"https://github.com/GoogleChrome/lighthouse.git","svn_url":"https://github.com/GoogleChrome/lighthouse","homepage":"https://developers.google.com/web/tools/lighthouse/","size":23230,"stargazers_count":13999,"watchers_count":13999,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":true,"forks_count":3964,"mirror_url":null,"archived":false,"open_issues_count":416,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":3964,"open_issues":416,"watchers":13999,"default_branch":"master"}},"base":{"label":"GoogleChrome:master","ref":"master","sha":"9e0341a8e002c0c54973737470c9de6eede0d582","user":{"login":"GoogleChrome","id":1778935,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3Nzg5MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/1778935?v=4","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"repo":{"id":53370988,"node_id":"MDEwOlJlcG9zaXRvcnk1MzM3MDk4OA==","name":"lighthouse","full_name":"GoogleChrome/lighthouse","owner":{"login":"GoogleChrome","id":1778935,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3Nzg5MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/1778935?v=4","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleChrome/lighthouse","description":"Auditing, performance metrics, and best practices for Progressive Web Apps","fork":false,"url":"https://api.github.com/repos/GoogleChrome/lighthouse","forks_url":"https://api.github.com/repos/GoogleChrome/lighthouse/forks","keys_url":"https://api.github.com/repos/GoogleChrome/lighthouse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleChrome/lighthouse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleChrome/lighthouse/teams","hooks_url":"https://api.github.com/repos/GoogleChrome/lighthouse/hooks","issue_events_url":"https://api.github.com/repos/GoogleChrome/lighthouse/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleChrome/lighthouse/events","assignees_url":"https://api.github.com/repos/GoogleChrome/lighthouse/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleChrome/lighthouse/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleChrome/lighthouse/tags","blobs_url":"https://api.github.com/repos/GoogleChrome/lighthouse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleChrome/lighthouse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleChrome/lighthouse/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleChrome/lighthouse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleChrome/lighthouse/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleChrome/lighthouse/languages","stargazers_url":"https://api.github.com/repos/GoogleChrome/lighthouse/stargazers","contributors_url":"https://api.github.com/repos/GoogleChrome/lighthouse/contributors","subscribers_url":"https://api.github.com/repos/GoogleChrome/lighthouse/subscribers","subscription_url":"https://api.github.com/repos/GoogleChrome/lighthouse/subscription","commits_url":"https://api.github.com/repos/GoogleChrome/lighthouse/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleChrome/lighthouse/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleChrome/lighthouse/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleChrome/lighthouse/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleChrome/lighthouse/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleChrome/lighthouse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleChrome/lighthouse/merges","archive_url":"https://api.github.com/repos/GoogleChrome/lighthouse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleChrome/lighthouse/downloads","issues_url":"https://api.github.com/repos/GoogleChrome/lighthouse/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleChrome/lighthouse/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleChrome/lighthouse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleChrome/lighthouse/labels{/name}","releases_url":"https://api.github.com/repos/GoogleChrome/lighthouse/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleChrome/lighthouse/deployments","created_at":"2016-03-08T01:03:11Z","updated_at":"2018-07-09T20:00:54Z","pushed_at":"2018-07-09T22:50:32Z","git_url":"git://github.com/GoogleChrome/lighthouse.git","ssh_url":"git@github.com:GoogleChrome/lighthouse.git","clone_url":"https://github.com/GoogleChrome/lighthouse.git","svn_url":"https://github.com/GoogleChrome/lighthouse","homepage":"https://developers.google.com/web/tools/lighthouse/","size":23230,"stargazers_count":13999,"watchers_count":13999,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":true,"forks_count":3964,"mirror_url":null,"archived":false,"open_issues_count":416,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":3964,"open_issues":416,"watchers":13999,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/5644"},"html":{"href":"https://github.com/GoogleChrome/lighthouse/pull/5644"},"issue":{"href":"https://api.github.com/repos/GoogleChrome/lighthouse/issues/5644"},"comments":{"href":"https://api.github.com/repos/GoogleChrome/lighthouse/issues/5644/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/5644/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/5644/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleChrome/lighthouse/statuses/9032e64ddcd6879f9fe2835c3a2cd82ce79050cb"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"patrickhulce"}}