{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/kibana/pulls/comments/83070735","pull_request_review_id":3935621,"id":83070735,"diff_hunk":"@@ -0,0 +1,87 @@\n+import fs from 'fs';","path":"src/core_plugins/i18n/server/tool/i18n_verify_keys.js","position":1,"original_position":1,"commit_id":"6e52f21b75071f691e3ffd2a7cb5566a6f6b8623","original_commit_id":"76925ccdfdb6c621df1dde56cfb557c2b0732ff3","user":{"login":"Bargs","id":6239176,"avatar_url":"https://avatars.githubusercontent.com/u/6239176?v=3","gravatar_id":"","url":"https://api.github.com/users/Bargs","html_url":"https://github.com/Bargs","followers_url":"https://api.github.com/users/Bargs/followers","following_url":"https://api.github.com/users/Bargs/following{/other_user}","gists_url":"https://api.github.com/users/Bargs/gists{/gist_id}","starred_url":"https://api.github.com/users/Bargs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bargs/subscriptions","organizations_url":"https://api.github.com/users/Bargs/orgs","repos_url":"https://api.github.com/users/Bargs/repos","events_url":"https://api.github.com/users/Bargs/events{/privacy}","received_events_url":"https://api.github.com/users/Bargs/received_events","type":"User","site_admin":false},"body":"So to verify that the translations exist *and* they're configured properly, I think we're going to have to boot up a Kibana server instance, ask the i18n module for all the registered translations for the default locale, and check them against all the translation keys extracted from any Jade templates found in the source. We could still do this during the build process, similar to [how the optimize step is run](https://github.com/elastic/kibana/blob/7323b95d5be4ba26a0494bff981eb96619bf1e92/tasks/build/index.js#L22-L22).\r\n\r\n@epixa does that sound reasonable to you?","created_at":"2016-10-12T18:36:14Z","updated_at":"2016-10-12T18:36:14Z","html_url":"https://github.com/elastic/kibana/pull/7545#discussion_r83070735","pull_request_url":"https://api.github.com/repos/elastic/kibana/pulls/7545","_links":{"self":{"href":"https://api.github.com/repos/elastic/kibana/pulls/comments/83070735"},"html":{"href":"https://github.com/elastic/kibana/pull/7545#discussion_r83070735"},"pull_request":{"href":"https://api.github.com/repos/elastic/kibana/pulls/7545"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/kibana/pulls/7545","id":75133774,"html_url":"https://github.com/elastic/kibana/pull/7545","diff_url":"https://github.com/elastic/kibana/pull/7545.diff","patch_url":"https://github.com/elastic/kibana/pull/7545.patch","issue_url":"https://api.github.com/repos/elastic/kibana/issues/7545","number":7545,"state":"open","locked":false,"title":"Kibana Globalization - Phase 1","user":{"login":"hickeyma","id":14892004,"avatar_url":"https://avatars.githubusercontent.com/u/14892004?v=3","gravatar_id":"","url":"https://api.github.com/users/hickeyma","html_url":"https://github.com/hickeyma","followers_url":"https://api.github.com/users/hickeyma/followers","following_url":"https://api.github.com/users/hickeyma/following{/other_user}","gists_url":"https://api.github.com/users/hickeyma/gists{/gist_id}","starred_url":"https://api.github.com/users/hickeyma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hickeyma/subscriptions","organizations_url":"https://api.github.com/users/hickeyma/orgs","repos_url":"https://api.github.com/users/hickeyma/repos","events_url":"https://api.github.com/users/hickeyma/events{/privacy}","received_events_url":"https://api.github.com/users/hickeyma/received_events","type":"User","site_admin":false},"body":"***Phase 1***\r\n-------------\r\n\r\n### Purpose\r\n-   Implement the i18n plugin which provides a means to supply translations in a standard format that it not dependent on a localization framework\r\n-   Translate the Kibana welcome message which proves that the i18n plugin provides translations as registered for Kibana\r\n\r\n### Decide Language for Translation Algorithm\r\n-   The algorithm which decides the language for loading translations is as follows:\r\n    -    If Kibana server property `kibana.language` set then this is the language returned.\r\n    -    Next, do a direct comparison with the HTTP header “accept-language” priority list against the registered translation languages or if Kibana server property `kibana.supportedLanguages` set then against this. If comparison found then this is the language returned.\r\n    -   Next, do a partial comparison whereby you try and get a language code comparison against the registered translation languages or if Kibana server property `kibana.supportedLanguages` set then against this. For example, \"fr\" or \"fr-FR\" is used for all regions of French if comparison applies. If comparison found then this is the language returned.\r\n    -   Finally, the default language as configured by the Kibana server property `kibana.defaultLanguage` is the language returned.  If property is not set then English \"en\" is used. \r\n    -   Additionally, the Kibana server property `kibana.defaultLanguage` is used if no HTTP header “accept-language” is set.\r\n-   Deliverable:\r\n    -   As per the i18n plugin\r\n\r\n### i18n Plugin\r\n-   Manages the language translations for Kibana\r\n-   Responsible for loading translated content per language\r\n-   The translations file are JSON files with a flat keyspace, where the keys are unique. This uniqueness between translation plugins could be achieved by prefixing the keys with the plugin name. The key signifies the translation ID which would be referenced in translatable files (like JS, HTML etc.).\r\n-   The key value is the translation string\r\n\r\n-   Example translation JSON file\r\n\r\n`kibana-en.json`\r\n\r\n```json \r\n    {\r\n        \"CORE-WELCOME_MESSAGE\": \"is loading. Give me a moment here. I'm loading a whole bunch of code. Don't worry, all this good stuff will be cached up for next time!\",\r\n        \"CORE-WELCOME_ERROR\": \"Kibana did not load properly. Check the server output for more information.\"\r\n    }\r\n```\r\n\r\n-   Core Kibana plugins like ‘kibana’ and ‘status\\_page’ could come with their own English translations bundled in\r\n-   API:\r\n    -   Register translations:\r\n        -   *registerTranslations(\\<absolute_path_to_translation_file\\>)*\r\n        -   The path to the translation file is registered with i18n plugin\r\n    -   Fetch the list of currently supported languages:\r\n        -   *getRegisteredTranslationLanguages()*\r\n        -   Returns a list of all languages as language codes for which translations are registered\r\n    -   Fetch a specific language translated content bundle:\r\n        -   *getRegisteredLanguageTranslations(\\<language\\_code\\>)*\r\n        -   Returns a JSON object of all registered translations for the language code specified\r\n        -   If language is not available for a key then substitute with the default language. If the default langauge is not available for the key then just return the key.\r\n-   Deliverable:\r\n    -   Translate the start-up message (“Kibana is loading ...”)in the Jade template\r\n        ([*https://github.com/elastic/kibana/blob/master/src/ui/views/ui\\_app.jade*](https://github.com/elastic/kibana/blob/master/src/ui/views/ui_app.jade))\r\n    -   Translation message will be loaded using the language as per the deciding algorithm. For phase 1 the default 'en' langauge will be used.\r\n    -   Plugin Unit tests \r\n    -   Jade template verification of translation strings:\r\n        -   Enforce a pattern to be used. For example a `translate(<key>)` function in the Jade template. A tool can then be used to find such pattern and extract the keys to file.\r\n        -   The keys in the key file(s) would then be checked against the language translation files registered\r\n    -   Core plugin registers its translation file during the initialization phase. The translation file contains strings for the welcome message and the start-up error message.","created_at":"2016-06-24T15:45:50Z","updated_at":"2016-10-12T18:36:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"23a2616398e546e5a198881fd2e7dd72162eb082","assignee":{"login":"Bargs","id":6239176,"avatar_url":"https://avatars.githubusercontent.com/u/6239176?v=3","gravatar_id":"","url":"https://api.github.com/users/Bargs","html_url":"https://github.com/Bargs","followers_url":"https://api.github.com/users/Bargs/followers","following_url":"https://api.github.com/users/Bargs/following{/other_user}","gists_url":"https://api.github.com/users/Bargs/gists{/gist_id}","starred_url":"https://api.github.com/users/Bargs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bargs/subscriptions","organizations_url":"https://api.github.com/users/Bargs/orgs","repos_url":"https://api.github.com/users/Bargs/repos","events_url":"https://api.github.com/users/Bargs/events{/privacy}","received_events_url":"https://api.github.com/users/Bargs/received_events","type":"User","site_admin":false},"assignees":[{"login":"Bargs","id":6239176,"avatar_url":"https://avatars.githubusercontent.com/u/6239176?v=3","gravatar_id":"","url":"https://api.github.com/users/Bargs","html_url":"https://github.com/Bargs","followers_url":"https://api.github.com/users/Bargs/followers","following_url":"https://api.github.com/users/Bargs/following{/other_user}","gists_url":"https://api.github.com/users/Bargs/gists{/gist_id}","starred_url":"https://api.github.com/users/Bargs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bargs/subscriptions","organizations_url":"https://api.github.com/users/Bargs/orgs","repos_url":"https://api.github.com/users/Bargs/repos","events_url":"https://api.github.com/users/Bargs/events{/privacy}","received_events_url":"https://api.github.com/users/Bargs/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/elastic/kibana/pulls/7545/commits","review_comments_url":"https://api.github.com/repos/elastic/kibana/pulls/7545/comments","review_comment_url":"https://api.github.com/repos/elastic/kibana/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/kibana/issues/7545/comments","statuses_url":"https://api.github.com/repos/elastic/kibana/statuses/6e52f21b75071f691e3ffd2a7cb5566a6f6b8623","head":{"label":"hickeyma:i18n_core_plugin","ref":"i18n_core_plugin","sha":"6e52f21b75071f691e3ffd2a7cb5566a6f6b8623","user":{"login":"hickeyma","id":14892004,"avatar_url":"https://avatars.githubusercontent.com/u/14892004?v=3","gravatar_id":"","url":"https://api.github.com/users/hickeyma","html_url":"https://github.com/hickeyma","followers_url":"https://api.github.com/users/hickeyma/followers","following_url":"https://api.github.com/users/hickeyma/following{/other_user}","gists_url":"https://api.github.com/users/hickeyma/gists{/gist_id}","starred_url":"https://api.github.com/users/hickeyma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hickeyma/subscriptions","organizations_url":"https://api.github.com/users/hickeyma/orgs","repos_url":"https://api.github.com/users/hickeyma/repos","events_url":"https://api.github.com/users/hickeyma/events{/privacy}","received_events_url":"https://api.github.com/users/hickeyma/received_events","type":"User","site_admin":false},"repo":{"id":61562949,"name":"kibana","full_name":"hickeyma/kibana","owner":{"login":"hickeyma","id":14892004,"avatar_url":"https://avatars.githubusercontent.com/u/14892004?v=3","gravatar_id":"","url":"https://api.github.com/users/hickeyma","html_url":"https://github.com/hickeyma","followers_url":"https://api.github.com/users/hickeyma/followers","following_url":"https://api.github.com/users/hickeyma/following{/other_user}","gists_url":"https://api.github.com/users/hickeyma/gists{/gist_id}","starred_url":"https://api.github.com/users/hickeyma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hickeyma/subscriptions","organizations_url":"https://api.github.com/users/hickeyma/orgs","repos_url":"https://api.github.com/users/hickeyma/repos","events_url":"https://api.github.com/users/hickeyma/events{/privacy}","received_events_url":"https://api.github.com/users/hickeyma/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hickeyma/kibana","description":":bar_chart: Kibana analytics and search dashboard for Elasticsearch","fork":true,"url":"https://api.github.com/repos/hickeyma/kibana","forks_url":"https://api.github.com/repos/hickeyma/kibana/forks","keys_url":"https://api.github.com/repos/hickeyma/kibana/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hickeyma/kibana/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hickeyma/kibana/teams","hooks_url":"https://api.github.com/repos/hickeyma/kibana/hooks","issue_events_url":"https://api.github.com/repos/hickeyma/kibana/issues/events{/number}","events_url":"https://api.github.com/repos/hickeyma/kibana/events","assignees_url":"https://api.github.com/repos/hickeyma/kibana/assignees{/user}","branches_url":"https://api.github.com/repos/hickeyma/kibana/branches{/branch}","tags_url":"https://api.github.com/repos/hickeyma/kibana/tags","blobs_url":"https://api.github.com/repos/hickeyma/kibana/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hickeyma/kibana/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hickeyma/kibana/git/refs{/sha}","trees_url":"https://api.github.com/repos/hickeyma/kibana/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hickeyma/kibana/statuses/{sha}","languages_url":"https://api.github.com/repos/hickeyma/kibana/languages","stargazers_url":"https://api.github.com/repos/hickeyma/kibana/stargazers","contributors_url":"https://api.github.com/repos/hickeyma/kibana/contributors","subscribers_url":"https://api.github.com/repos/hickeyma/kibana/subscribers","subscription_url":"https://api.github.com/repos/hickeyma/kibana/subscription","commits_url":"https://api.github.com/repos/hickeyma/kibana/commits{/sha}","git_commits_url":"https://api.github.com/repos/hickeyma/kibana/git/commits{/sha}","comments_url":"https://api.github.com/repos/hickeyma/kibana/comments{/number}","issue_comment_url":"https://api.github.com/repos/hickeyma/kibana/issues/comments{/number}","contents_url":"https://api.github.com/repos/hickeyma/kibana/contents/{+path}","compare_url":"https://api.github.com/repos/hickeyma/kibana/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hickeyma/kibana/merges","archive_url":"https://api.github.com/repos/hickeyma/kibana/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hickeyma/kibana/downloads","issues_url":"https://api.github.com/repos/hickeyma/kibana/issues{/number}","pulls_url":"https://api.github.com/repos/hickeyma/kibana/pulls{/number}","milestones_url":"https://api.github.com/repos/hickeyma/kibana/milestones{/number}","notifications_url":"https://api.github.com/repos/hickeyma/kibana/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hickeyma/kibana/labels{/name}","releases_url":"https://api.github.com/repos/hickeyma/kibana/releases{/id}","deployments_url":"https://api.github.com/repos/hickeyma/kibana/deployments","created_at":"2016-06-20T16:28:01Z","updated_at":"2016-06-20T16:28:05Z","pushed_at":"2016-10-12T09:07:02Z","git_url":"git://github.com/hickeyma/kibana.git","ssh_url":"git@github.com:hickeyma/kibana.git","clone_url":"https://github.com/hickeyma/kibana.git","svn_url":"https://github.com/hickeyma/kibana","homepage":"https://www.elastic.co/products/kibana","size":217807,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"elastic:master","ref":"master","sha":"d673a53bd0757aefe95e2c2234c96904b5d00c63","user":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":7833168,"name":"kibana","full_name":"elastic/kibana","owner":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/kibana","description":":bar_chart: Kibana analytics and search dashboard for Elasticsearch","fork":false,"url":"https://api.github.com/repos/elastic/kibana","forks_url":"https://api.github.com/repos/elastic/kibana/forks","keys_url":"https://api.github.com/repos/elastic/kibana/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/kibana/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/kibana/teams","hooks_url":"https://api.github.com/repos/elastic/kibana/hooks","issue_events_url":"https://api.github.com/repos/elastic/kibana/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/kibana/events","assignees_url":"https://api.github.com/repos/elastic/kibana/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/kibana/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/kibana/tags","blobs_url":"https://api.github.com/repos/elastic/kibana/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/kibana/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/kibana/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/kibana/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/kibana/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/kibana/languages","stargazers_url":"https://api.github.com/repos/elastic/kibana/stargazers","contributors_url":"https://api.github.com/repos/elastic/kibana/contributors","subscribers_url":"https://api.github.com/repos/elastic/kibana/subscribers","subscription_url":"https://api.github.com/repos/elastic/kibana/subscription","commits_url":"https://api.github.com/repos/elastic/kibana/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/kibana/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/kibana/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/kibana/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/kibana/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/kibana/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/kibana/merges","archive_url":"https://api.github.com/repos/elastic/kibana/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/kibana/downloads","issues_url":"https://api.github.com/repos/elastic/kibana/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/kibana/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/kibana/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/kibana/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/kibana/labels{/name}","releases_url":"https://api.github.com/repos/elastic/kibana/releases{/id}","deployments_url":"https://api.github.com/repos/elastic/kibana/deployments","created_at":"2013-01-26T04:00:59Z","updated_at":"2016-10-12T16:39:03Z","pushed_at":"2016-10-12T17:27:46Z","git_url":"git://github.com/elastic/kibana.git","ssh_url":"git@github.com:elastic/kibana.git","clone_url":"https://github.com/elastic/kibana.git","svn_url":"https://github.com/elastic/kibana","homepage":"https://www.elastic.co/products/kibana","size":266663,"stargazers_count":6126,"watchers_count":6126,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2260,"mirror_url":null,"open_issues_count":1204,"forks":2260,"open_issues":1204,"watchers":6126,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/kibana/pulls/7545"},"html":{"href":"https://github.com/elastic/kibana/pull/7545"},"issue":{"href":"https://api.github.com/repos/elastic/kibana/issues/7545"},"comments":{"href":"https://api.github.com/repos/elastic/kibana/issues/7545/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/kibana/pulls/7545/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/kibana/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/kibana/pulls/7545/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/kibana/statuses/6e52f21b75071f691e3ffd2a7cb5566a6f6b8623"}}}}
{"actor":{"display_login":"Bargs"}}