{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/kibana/issues/6515","repository_url":"https://api.github.com/repos/elastic/kibana","labels_url":"https://api.github.com/repos/elastic/kibana/issues/6515/labels{/name}","comments_url":"https://api.github.com/repos/elastic/kibana/issues/6515/comments","events_url":"https://api.github.com/repos/elastic/kibana/issues/6515/events","html_url":"https://github.com/elastic/kibana/issues/6515","id":140292422,"number":6515,"title":"Kibana Globalization","user":{"login":"srl295","id":855219,"avatar_url":"https://avatars.githubusercontent.com/u/855219?v=3","gravatar_id":"","url":"https://api.github.com/users/srl295","html_url":"https://github.com/srl295","followers_url":"https://api.github.com/users/srl295/followers","following_url":"https://api.github.com/users/srl295/following{/other_user}","gists_url":"https://api.github.com/users/srl295/gists{/gist_id}","starred_url":"https://api.github.com/users/srl295/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srl295/subscriptions","organizations_url":"https://api.github.com/users/srl295/orgs","repos_url":"https://api.github.com/users/srl295/repos","events_url":"https://api.github.com/users/srl295/events{/privacy}","received_events_url":"https://api.github.com/users/srl295/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elastic/kibana/labels/discuss","name":"discuss","color":"cc317c"}],"state":"open","locked":false,"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,"comments":67,"created_at":"2016-03-11T21:09:56Z","updated_at":"2016-08-02T14:38:35Z","closed_at":null,"body":"Kibana Globalization Proposal\r\n=============================\r\n\r\nPurpose\r\n-------\r\n-   Provide translation readiness on the Kibana web-facing UI\r\n-   Delivered in a phased approach\r\n\r\n***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### 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-   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    -   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.\r\n\r\n***Phase 2***\r\n-------------\r\n\r\n### Purpose\r\n-   Create a boilerplate plugin which localization engineers can use to translate Kibana for different languages\r\n-   Add `get translations` REST API to i18n plugin to return translations per language\r\n-   Translate a view with an angular contruct and a HTML view which proves that UI localization frameworks integrates with i18n plugin to translate the Kibana views\r\n\r\n### Translation Plugin Boilerplate\r\n-   A boilerplate of a Kibana plugin which contains the minimal of actual code to enable registration of translations with the i18n plugin\r\n-   The translation plugin calls the i18n register translations at the plugin initialization phase\r\n-   The plugin contains a translation JSON file per language\r\n-   An example translation plugin structure :\r\n    [*https://github.com/Bargs/management-es*](https://github.com/Bargs/management-es)\r\n-   Deliverables:\r\n    -   A template that localization engineers can use to produce language translations and integrate them in Kibana in an easy manner\r\n    -   Translation plugin registers its translations during the plugin initialization phase\r\n\r\n### i18n Plugin (update)\r\n-   Add REST API for getting all translations for a language:\r\n    -   GET /i18n/translations ==\\> returns the English (or German or whatever) translations negotiated with the browser HTTP header “accept-language” priority list compared against the languages supported\r\n-   Deliverable:\r\n    -   Automated API tests pass\r\n    -   Make the translations available on the client side:\r\n        -   2 approaches:\r\n            -   Use current bundle mechanism:\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)) to call API and generate the bundle which will be loaded during start-up\r\n                -   The JavaScript bundle produced will be of the following format: *i18n\\_\\<language\\>.bundle.js*\r\n                -   Kibana loads all resource bundles on the client side after starting the single-page application\r\n            -   Client side directly calls API and loads the JSON payload\r\n            -   Both approaches will decide the language to be served up by comparing browser languages against the translation supported languages\r\n        -   PoC:\r\n            -   View sample of angular constructs can load translations\r\n            -   Sample HTML View can load translations\r\n\r\n***Phase 3***\r\n-------------\r\n\r\n### Purpose\r\n-   Add the translation identifiers and English translation strings for the rest of the Kibana UI\r\n-   Implement a tool to generate the translation plugin\r\n-   Tool used by CI to verify all translation identifiers has a corresponding translation\r\n\r\n### Translation Plugin Generator\r\n-   Tool which generates a translation plugin\r\n-   Localization engineer should only need to add translation file(s) within the plugin directory and add plugin to Kibana\r\n-   Deliverable:\r\n    -   Translation plugin is generated which can be installed as plugin in Kibana with he translation files registered during the plugin initialization phase\r\n\r\n### Tool for Verifying All Translations have Translatable Strings\r\n-   Grunt run task tool that tests all translatable strings have a translation (i.e. all translation IDs have a corresponding translation string)\r\n-   This could be run by CI to verify globalization end-to-end capability\r\n-   A possible solution:\r\n    -   [*https://github.com/angular-translate/grunt-angular-translate*](https://github.com/angular-translate/grunt-angular-translate).Searches all view and JS scripts to find angular-translate calls and extracts keys to file\r\n    -   For non-angular constructs: 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-   Deliverable:\r\n    -   Tool can be run by CI to verify translation IDs have a corresponding translation string\r\n\r\n### Translation Identifiers Added to Kibana UI\r\n-   Ids are added to the relevant UI content (HTML, JS etc.)\r\n-   English (en) translation file(s) are generated for the Ids defined\r\n-   Approach for translating UI content:\r\n    -   Angular UI portion:\r\n        -   Use [angular-translate](https://angular-translate.github.io) for simplicity of the UI template resources, taking advantage of angular idioms.\r\n    -   Non-Angular portion:\r\n        -   Source and translations are in basic JSON format, and the same file can be consumed without the `angular-translate` module. For example, the Node server side can use the JSON format.\r\n        -   Enforce a pattern to be used. For example a `translate(<key>)` function in the Jade template.\r\n\r\n#### BEFORE (HTML)\r\n\r\n```html\r\n    <div class=\"sidebar-list\">\r\n    …\r\n\r\n    <div class=\"sidebar-list-header\">\r\n        <h5>Selected Fields</h5>\r\n    </div>\r\n```\r\n\r\n#### AFTER (HTML)\r\n\r\n```html\r\n    <div class=\"sidebar-list\">\r\n    …\r\n\r\n    <div class=\"sidebar-list-header\">\r\n        <h5 translate=\"FIELDS_SELECTEDFIELDS\"></h5>\r\n    </div>\r\n```\r\n\r\n#### BEFORE (Chart)\r\n\r\n```js\r\n    return new MetricAggType({\r\n      title: 'Count',\r\n```\r\n\r\n#### AFTER (Chart) - non-Angular\r\n\r\n```js\r\n    var uiStrings = …; // loading TBD\r\n    return new MetricAggType({\r\n      title: uiStrings.METRIC_COUNT,\r\n```\r\n\r\n-   Deliverables:\r\n    -   Tool can be run by CI to verify translation IDs have a corresponding translation string\r\n    -   Localization engineers can start generating translation plugins for different languages\r\n\r\n***Blockers***\r\n--------------\r\n\r\n***Open Questions/Issues***\r\n---------------------------\r\n-   Translation of user data\r\n-   Decide the phases to be delivered in the Elastic release candidates\r\n\r\nAuthors\r\n------------------------------------------\r\n-   Martin Hickey: @hickeyma\r\n-   Scott Russell: @DTownSMR \r\n-   Shikha Srivastava: @shikhasriva\r\n-   Steven R. Loomis: @srl295"},"comment":{"url":"https://api.github.com/repos/elastic/kibana/issues/comments/236924815","html_url":"https://github.com/elastic/kibana/issues/6515#issuecomment-236924815","issue_url":"https://api.github.com/repos/elastic/kibana/issues/6515","id":236924815,"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},"created_at":"2016-08-02T14:38:34Z","updated_at":"2016-08-02T14:38:34Z","body":"@srl295, could you also add this line to i18n Plugin (update) in Phase 2:\r\n-   The algorithm which decides the translation language to use for retrieving the translations works as follows:\r\n     -   First, do a direct comparison with the HTTP header “accept-language” priority list against the registered translation languages.\r\n     -   Next, do a partial comparison whereby you try and get a language code comparison. For example, \"fr\" or \"fr-FR\" is used for all regions of French if comparison applies.\r\n     -   Finally, the default language as configured per Kibana instance is used.  Default configuration is \"en\". This is also used if no HTTP header “accept-language” is set."}}
{"actor":{"display_login":"hickeyma"}}