{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/kibana/pulls/comments/188233783","pull_request_review_id":120166912,"id":188233783,"diff_hunk":"@@ -0,0 +1,169 @@\n+## I18n engine\n+\n+[React-intl](https://github.com/yahoo/react-intl) is built around\n+[intl-messageformat](https://github.com/yahoo/intl-messageformat),\n+so both react and angular frameworks will use the same engine and\n+the same message syntax. The engine uses the ICU Message syntax\n+and works for all CLDR languages which have pluralization rules\n+defined. `intl-messageformat` package exposes `IntlMessageFormat`\n+constructor. Messages are provided into the constructor as a\n+string message, or a pre-parsed AST object.\n+\n+```\n+import IntlMessageFormat from 'intl-messageformat';\n+\n+const msg = new IntlMessageFormat(message, locales, [formats]);\n+```\n+\n+The string `message` is parsed, then stored internally in a\n+compiled form that is optimized for the `format()` method to\n+produce the formatted string for displaying to the user.\n+\n+```\n+const output = msg.format(values);\n+```\n+\n+Creating instances of `IntlMessageFormat` is an expensive operation.\n+[Intl-format-cache](https://github.com/yahoo/intl-format-cache)\n+library is simply to make it easier to create a cache of format\n+instances of a particular type to aid in their reuse. Under the\n+hood, this package creates a cache key based on the arguments passed\n+to the memoized constructor.\n+\n+```\n+import memoizeIntlConstructor from 'intl-format-cache';\n+\n+const getMessageFormat = memoizeIntlConstructor(IntlMessageFormat);\n+```\n+\n+`Intl-messageformat` package assumes that the\n+[Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl)\n+global object exists in the runtime. `Intl` is present in all modern\n+browsers and Node.js > 0.10. In order to load `Intl MessageFormat`\n+in Node.js we should simply `require()` this package (in Node.js,\n+the data for all 200+ languages is loaded along with the library):\n+```\n+const IntlMessageFormat = require('intl-messageformat');\n+```\n+\n+After that we are able to use this library in the same way as for browsers.\n+\n+## Angular wrapper\n+\n+Angular wrapper will have at least 3 entities: translation `service`,\n+`directive` and `filter`. Both, the directive and the filter will use\n+the translation service with `intl-messageformat` library under the hood.\n+\n+The translation `service` will provide the following methods (names can be changed):\n+- `addMessages(messages: object, [locale: string])` - provides a way to register\n+translations with the library\n+- `getMessages()` - returns messages for the current language\n+- `locale(locale: string)` - tells the library which language to use by given\n+language key\n+- `locale()` - returns the current locale \n+- `defaultLocale(locale: string)` - tells the library which language to fallback\n+when missing translations\n+- `defaultLocale()` - returns the default locale\n+- `defineFormats(formats: object)` - supply a set of options to the underlying formatter\n+- `translate({id: string, values: object, defaultMessage: string})` – translate message by id\n+\n+The translation `filter` will look like this:","path":"src/ui/ui_i18n/README.md","position":70,"original_position":70,"commit_id":"73b964cdff32a1cee4f229dafd3a7fe3f393b3ad","original_commit_id":"73b964cdff32a1cee4f229dafd3a7fe3f393b3ad","user":{"login":"maksim-tolo","id":11413965,"avatar_url":"https://avatars3.githubusercontent.com/u/11413965?v=4","gravatar_id":"","url":"https://api.github.com/users/maksim-tolo","html_url":"https://github.com/maksim-tolo","followers_url":"https://api.github.com/users/maksim-tolo/followers","following_url":"https://api.github.com/users/maksim-tolo/following{/other_user}","gists_url":"https://api.github.com/users/maksim-tolo/gists{/gist_id}","starred_url":"https://api.github.com/users/maksim-tolo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maksim-tolo/subscriptions","organizations_url":"https://api.github.com/users/maksim-tolo/orgs","repos_url":"https://api.github.com/users/maksim-tolo/repos","events_url":"https://api.github.com/users/maksim-tolo/events{/privacy}","received_events_url":"https://api.github.com/users/maksim-tolo/received_events","type":"User","site_admin":false},"body":"It's possible, but we can get names collision if 2 translation keys will have the same variable names, so developers should keep in mind this fact. We can add extra checking for translation keys and show warnings for duplicating variable names in the same scope","created_at":"2018-05-15T10:10:06Z","updated_at":"2018-05-15T10:10:06Z","html_url":"https://github.com/elastic/kibana/pull/18725#discussion_r188233783","pull_request_url":"https://api.github.com/repos/elastic/kibana/pulls/18725","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/elastic/kibana/pulls/comments/188233783"},"html":{"href":"https://github.com/elastic/kibana/pull/18725#discussion_r188233783"},"pull_request":{"href":"https://api.github.com/repos/elastic/kibana/pulls/18725"}},"in_reply_to_id":185589652},"pull_request":{"url":"https://api.github.com/repos/elastic/kibana/pulls/18725","id":185466001,"html_url":"https://github.com/elastic/kibana/pull/18725","diff_url":"https://github.com/elastic/kibana/pull/18725.diff","patch_url":"https://github.com/elastic/kibana/pull/18725.patch","issue_url":"https://api.github.com/repos/elastic/kibana/issues/18725","number":18725,"state":"open","locked":false,"title":"Add technical-level explanation for i18n","user":{"login":"maksim-tolo","id":11413965,"avatar_url":"https://avatars3.githubusercontent.com/u/11413965?v=4","gravatar_id":"","url":"https://api.github.com/users/maksim-tolo","html_url":"https://github.com/maksim-tolo","followers_url":"https://api.github.com/users/maksim-tolo/followers","following_url":"https://api.github.com/users/maksim-tolo/following{/other_user}","gists_url":"https://api.github.com/users/maksim-tolo/gists{/gist_id}","starred_url":"https://api.github.com/users/maksim-tolo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maksim-tolo/subscriptions","organizations_url":"https://api.github.com/users/maksim-tolo/orgs","repos_url":"https://api.github.com/users/maksim-tolo/repos","events_url":"https://api.github.com/users/maksim-tolo/events{/privacy}","received_events_url":"https://api.github.com/users/maksim-tolo/received_events","type":"User","site_admin":false},"body":"Add draft technical-level explanation for i18n.","created_at":"2018-05-02T14:57:33Z","updated_at":"2018-05-15T10:10:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3415b783b9cbc2d8735f2ba34cbb48d50c35c467","assignee":null,"assignees":[],"requested_reviewers":[{"login":"epixa","id":53814,"avatar_url":"https://avatars0.githubusercontent.com/u/53814?v=4","gravatar_id":"","url":"https://api.github.com/users/epixa","html_url":"https://github.com/epixa","followers_url":"https://api.github.com/users/epixa/followers","following_url":"https://api.github.com/users/epixa/following{/other_user}","gists_url":"https://api.github.com/users/epixa/gists{/gist_id}","starred_url":"https://api.github.com/users/epixa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epixa/subscriptions","organizations_url":"https://api.github.com/users/epixa/orgs","repos_url":"https://api.github.com/users/epixa/repos","events_url":"https://api.github.com/users/epixa/events{/privacy}","received_events_url":"https://api.github.com/users/epixa/received_events","type":"User","site_admin":false},{"login":"spalger","id":1329312,"avatar_url":"https://avatars1.githubusercontent.com/u/1329312?v=4","gravatar_id":"","url":"https://api.github.com/users/spalger","html_url":"https://github.com/spalger","followers_url":"https://api.github.com/users/spalger/followers","following_url":"https://api.github.com/users/spalger/following{/other_user}","gists_url":"https://api.github.com/users/spalger/gists{/gist_id}","starred_url":"https://api.github.com/users/spalger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spalger/subscriptions","organizations_url":"https://api.github.com/users/spalger/orgs","repos_url":"https://api.github.com/users/spalger/repos","events_url":"https://api.github.com/users/spalger/events{/privacy}","received_events_url":"https://api.github.com/users/spalger/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":548254520,"url":"https://api.github.com/repos/elastic/kibana/labels/:i18n","name":":i18n","color":"009800","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/elastic/kibana/pulls/18725/commits","review_comments_url":"https://api.github.com/repos/elastic/kibana/pulls/18725/comments","review_comment_url":"https://api.github.com/repos/elastic/kibana/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/kibana/issues/18725/comments","statuses_url":"https://api.github.com/repos/elastic/kibana/statuses/73b964cdff32a1cee4f229dafd3a7fe3f393b3ad","head":{"label":"maksim-tolo:i18n-tech-guide","ref":"i18n-tech-guide","sha":"73b964cdff32a1cee4f229dafd3a7fe3f393b3ad","user":{"login":"maksim-tolo","id":11413965,"avatar_url":"https://avatars3.githubusercontent.com/u/11413965?v=4","gravatar_id":"","url":"https://api.github.com/users/maksim-tolo","html_url":"https://github.com/maksim-tolo","followers_url":"https://api.github.com/users/maksim-tolo/followers","following_url":"https://api.github.com/users/maksim-tolo/following{/other_user}","gists_url":"https://api.github.com/users/maksim-tolo/gists{/gist_id}","starred_url":"https://api.github.com/users/maksim-tolo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maksim-tolo/subscriptions","organizations_url":"https://api.github.com/users/maksim-tolo/orgs","repos_url":"https://api.github.com/users/maksim-tolo/repos","events_url":"https://api.github.com/users/maksim-tolo/events{/privacy}","received_events_url":"https://api.github.com/users/maksim-tolo/received_events","type":"User","site_admin":false},"repo":{"id":125487946,"name":"kibana","full_name":"maksim-tolo/kibana","owner":{"login":"maksim-tolo","id":11413965,"avatar_url":"https://avatars3.githubusercontent.com/u/11413965?v=4","gravatar_id":"","url":"https://api.github.com/users/maksim-tolo","html_url":"https://github.com/maksim-tolo","followers_url":"https://api.github.com/users/maksim-tolo/followers","following_url":"https://api.github.com/users/maksim-tolo/following{/other_user}","gists_url":"https://api.github.com/users/maksim-tolo/gists{/gist_id}","starred_url":"https://api.github.com/users/maksim-tolo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maksim-tolo/subscriptions","organizations_url":"https://api.github.com/users/maksim-tolo/orgs","repos_url":"https://api.github.com/users/maksim-tolo/repos","events_url":"https://api.github.com/users/maksim-tolo/events{/privacy}","received_events_url":"https://api.github.com/users/maksim-tolo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/maksim-tolo/kibana","description":":bar_chart: Kibana analytics and search dashboard for Elasticsearch","fork":true,"url":"https://api.github.com/repos/maksim-tolo/kibana","forks_url":"https://api.github.com/repos/maksim-tolo/kibana/forks","keys_url":"https://api.github.com/repos/maksim-tolo/kibana/keys{/key_id}","collaborators_url":"https://api.github.com/repos/maksim-tolo/kibana/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/maksim-tolo/kibana/teams","hooks_url":"https://api.github.com/repos/maksim-tolo/kibana/hooks","issue_events_url":"https://api.github.com/repos/maksim-tolo/kibana/issues/events{/number}","events_url":"https://api.github.com/repos/maksim-tolo/kibana/events","assignees_url":"https://api.github.com/repos/maksim-tolo/kibana/assignees{/user}","branches_url":"https://api.github.com/repos/maksim-tolo/kibana/branches{/branch}","tags_url":"https://api.github.com/repos/maksim-tolo/kibana/tags","blobs_url":"https://api.github.com/repos/maksim-tolo/kibana/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/maksim-tolo/kibana/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/maksim-tolo/kibana/git/refs{/sha}","trees_url":"https://api.github.com/repos/maksim-tolo/kibana/git/trees{/sha}","statuses_url":"https://api.github.com/repos/maksim-tolo/kibana/statuses/{sha}","languages_url":"https://api.github.com/repos/maksim-tolo/kibana/languages","stargazers_url":"https://api.github.com/repos/maksim-tolo/kibana/stargazers","contributors_url":"https://api.github.com/repos/maksim-tolo/kibana/contributors","subscribers_url":"https://api.github.com/repos/maksim-tolo/kibana/subscribers","subscription_url":"https://api.github.com/repos/maksim-tolo/kibana/subscription","commits_url":"https://api.github.com/repos/maksim-tolo/kibana/commits{/sha}","git_commits_url":"https://api.github.com/repos/maksim-tolo/kibana/git/commits{/sha}","comments_url":"https://api.github.com/repos/maksim-tolo/kibana/comments{/number}","issue_comment_url":"https://api.github.com/repos/maksim-tolo/kibana/issues/comments{/number}","contents_url":"https://api.github.com/repos/maksim-tolo/kibana/contents/{+path}","compare_url":"https://api.github.com/repos/maksim-tolo/kibana/compare/{base}...{head}","merges_url":"https://api.github.com/repos/maksim-tolo/kibana/merges","archive_url":"https://api.github.com/repos/maksim-tolo/kibana/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/maksim-tolo/kibana/downloads","issues_url":"https://api.github.com/repos/maksim-tolo/kibana/issues{/number}","pulls_url":"https://api.github.com/repos/maksim-tolo/kibana/pulls{/number}","milestones_url":"https://api.github.com/repos/maksim-tolo/kibana/milestones{/number}","notifications_url":"https://api.github.com/repos/maksim-tolo/kibana/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/maksim-tolo/kibana/labels{/name}","releases_url":"https://api.github.com/repos/maksim-tolo/kibana/releases{/id}","deployments_url":"https://api.github.com/repos/maksim-tolo/kibana/deployments","created_at":"2018-03-16T08:38:47Z","updated_at":"2018-03-16T08:38:58Z","pushed_at":"2018-05-02T14:39:16Z","git_url":"git://github.com/maksim-tolo/kibana.git","ssh_url":"git@github.com:maksim-tolo/kibana.git","clone_url":"https://github.com/maksim-tolo/kibana.git","svn_url":"https://github.com/maksim-tolo/kibana","homepage":"https://www.elastic.co/products/kibana","size":379182,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"d77cc5676bc534c1d1de1f160e213bd66fb8a78c","user":{"login":"elastic","id":6764390,"avatar_url":"https://avatars0.githubusercontent.com/u/6764390?v=4","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://avatars0.githubusercontent.com/u/6764390?v=4","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":"2018-05-15T08:25:05Z","pushed_at":"2018-05-15T09:19:38Z","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":388900,"stargazers_count":9349,"watchers_count":9349,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3631,"mirror_url":null,"archived":false,"open_issues_count":3099,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":3631,"open_issues":3099,"watchers":9349,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/kibana/pulls/18725"},"html":{"href":"https://github.com/elastic/kibana/pull/18725"},"issue":{"href":"https://api.github.com/repos/elastic/kibana/issues/18725"},"comments":{"href":"https://api.github.com/repos/elastic/kibana/issues/18725/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/kibana/pulls/18725/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/kibana/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/kibana/pulls/18725/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/kibana/statuses/73b964cdff32a1cee4f229dafd3a7fe3f393b3ad"}},"author_association":"NONE"}}
{"actor":{"display_login":"maksim-tolo"}}