Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kibana Globalization - Phase 1 #7545

Merged
merged 68 commits into from
Dec 14, 2016
Merged

Commits on Dec 13, 2016

  1. Add low level i18n plugin

    Manages languages that are available and is responsible for loading translated
    content at the granularity of a plugin.
    
    To be done:
     - APIs for store and retrieval
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    aca671f View commit details
    Browse the repository at this point in the history
  2. Use Kibana install as root for the translation store directory

    Setting the path for storing the bundled language translation files to
    <KIBANA_INSTALL>/data/store_translations/<PLUGIN_NAME>
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    c3ba578 View commit details
    Browse the repository at this point in the history
  3. Updated i18n core plugin APIs to be asynchronous

    To be done:
     - Better error handling in APIs
     - Fix threading issue with storePluginLanguageTranslations API
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    80d8a2c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    856fb02 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    c5d22be View commit details
    Browse the repository at this point in the history
  6. Change to use NodeJS mkdirp function for creating directories recursi…

    …vely
    
    Updates with review comments from @srl295. Changed export syntax to show the
    exported functions at end of file.
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    b37e4f8 View commit details
    Browse the repository at this point in the history
  7. Add REST API for getting translations of a language for a plugin

    To be done:
     - Add algorithm to decide on the language for a plugin by comparing the accept languages
    from the REST call and the plugin supported languages
     - Add REST API tests
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    ec6d2b1 View commit details
    Browse the repository at this point in the history
  8. Add algorithm for determining plugin language when retrieving transla…

    …tions
    
    Client would pass languages used in the 'accept-language' header. These
    languages would then be compared against the plugin supported languages
    and best compared language would be selected.
    
    To be done:
     - Add REST API tests
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    a75faae View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    66d051b View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    c3403e7 View commit details
    Browse the repository at this point in the history
  11. Update register translations API to be independent of plugin name and…

    … language
    
    The register API is updated to be independent of plugin name and language. The API will now
    traverse the path given and create language bundles as per language files it traverses.
    The translations files structure has also been simplified to be just key/value objects.
    
    To be done:
     - Add hapi API to get translations
     - Extend the API tests to test responses
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    0f4902d View commit details
    Browse the repository at this point in the history
  12. Update API test

    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    9785df2 View commit details
    Browse the repository at this point in the history
  13. Add eslint fix for API test

    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    d41fcec View commit details
    Browse the repository at this point in the history
  14. Update with review comments

    From review elastic#7545 (comment)
    following comments updated:
    - README, .gitignore, and .eslintrc are not needed in a core plugin
    - package.json only needs name and version
    - unit tests need to go in a tests directory otherwise they won't get picked up
    by the grunt tasks. Also our convention is to name the test file with the same
    name as the module it's testing (so i18n_tests.js should just be i18n.js)
    - For consistency with the rest of the code base, rename the data directory to fixtures.
    - Prefer const (or let if necessary). Don't use var.
    - Use ES6 imports/exports rather than commonjs style
    - Only export the i18n module's public API. For instance, I don't think getPluginTranslationDetails is used outside of the i18n module, so it shouldn't be exposed publicly. If you want to expose it for testing purposes, I would recommend creating an i18n directory with an index.js file that exports the module's public API, and a separate i18n.js file with the "private" API. index.js will be for public use, i18n.js will be for private internal use.
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    c8b2197 View commit details
    Browse the repository at this point in the history
  15. Update after review comments

    From review (elastic#7545 (comment)):
    - i18n module API should return promises for async operations instead of using
    callbacks
    - All filesystem access should be async
    - Unit tests need to be updated based on new proposed plugin structure
    (single language file, not split by view)
    
    From design (elastic#6515 (comment)):
    - Removed API as will consider in later phase
    
    TODO:
    - Make write function async
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    e17653d View commit details
    Browse the repository at this point in the history
  16. Update after review comments

    Updated write function to be asynchronous
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    eaf35ab View commit details
    Browse the repository at this point in the history
  17. Update registerTranslations API to take absolute translation file as …

    …argument
    
    The API originally took the directory as the argument but following reviews it
    was decided to change to absolute file because it will be less brittle
    since it is more explicit.
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    f1974ca View commit details
    Browse the repository at this point in the history
  18. Translate the Kibana welcome message

    Translates the start-up message (“Kibana is loading ...”)in the Jade template.
    
    To be done:
     - Means to register the core plugin translations. They are currently added
    in the fixtures directory as static files. Need to be generated on the fly.
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    10db458 View commit details
    Browse the repository at this point in the history
  19. Add build task to generate core plugin translations

    Task which calls registerTranslations API and then a task which copies the
    regsitered translations to <kibana_root>/build/kibana
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    4957173 View commit details
    Browse the repository at this point in the history
  20. Add hook to optimize module to add registration during dev startup

    Registration of the core plugin translations during development start of
    Kibana server. The translations include the welcome message and server error
    startup message.
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    5f61475 View commit details
    Browse the repository at this point in the history
  21. Handle scenario when the user preferred language header is not passed

    The UI when loading asks i18n plugin which language translation to use
    depending on the user preferred language header 'accept-language'.
    This commit is to handle scenario where header is not passed. The algorithm
    then chooses the default language.
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    9fbe6d5 View commit details
    Browse the repository at this point in the history
  22. Replace registering of translations at plugin install time to the plu…

    …gin init phase
    
    This change follows review comments in:
    elastic#6515 (comment)
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    32d5034 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    8c7f51c View commit details
    Browse the repository at this point in the history
  24. Update after plugin folder layout changes in Kibana

    This require to use <kibana_root>/data for registered translations
    and i18n plugin moved to core_plugins from plugins.
    
    Refer to PR for more details:
    elastic#7562
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    b84f40a View commit details
    Browse the repository at this point in the history
  25. Update translation registration to file path rather than bundling

    After review discussions it was agreed to just register the absolute paths
    to translation files rather than bundling each file into one central file
    at registration.
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    2dd3065 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    db11a2d View commit details
    Browse the repository at this point in the history
  27. Update review comments

    The following review comments are included in the commit:
    - elastic#7545 (comment)
    - elastic#7545 (comment)
    - elastic#7545 (comment)
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    8c39a8d View commit details
    Browse the repository at this point in the history
  28. Expose the i18n APIs in the server object for plugin access

    Plugins should call the i18n plugin APIs through the server object
    and not directly from the module.
    
    This closes he following comments:
    - elastic#7545 (comment)
    - elastic#7545 (comment)
    - elastic#7545 (comment)
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    a9e30d3 View commit details
    Browse the repository at this point in the history
  29. Update accept-language-parser module to 1.2.0

    Module version 1.2.0 fixes issue:
    opentable/accept-language-parser#8
    
    This commit updates review comments:
    elastic#7545 (diff)
    elastic#7545 (comment)
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    da669da View commit details
    Browse the repository at this point in the history
  30. Add i18n default locale as a configurable item

    Adds 'defaultLocale' configurable item to the i18n plugin configuration.
    The default locale is used for translations if the locale specified by user
    is not supported.
    
    This commit satisfies the review comment:
    - elastic#7545 (diff)
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    9064e8a View commit details
    Browse the repository at this point in the history
  31. Move UI i18n wrapper functionality into a module

    This commit better structures the i18n capability so that it can be called
    in UI code in a clearly defined fashion with minimum code. It also fixes
    potential race conditions.
    
    This commit updates review comments:
    - elastic#7545 (diff)
    - elastic#7545 (diff)
    - elastic#7545 (diff)
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    c20a204 View commit details
    Browse the repository at this point in the history
  32. Fill any missing translations using translations from default locale

    The default language translations are loaded and are compared against the selected
    language translations. The comparison can then highlight any missing translation
    keys and can load the default translations keys as needed. This helps to unsure
    where possible that a translation string is available in most scenarios even if not
    in the locale requested.
    
    This commit resolves review comments:
    - elastic#7545 (comment)
    - elastic#7545 (comment)
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    5a17a15 View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    8abf25c View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    62a4986 View commit details
    Browse the repository at this point in the history
  35. Add translation keys verification tool

    This tool helps to check that translation keys are translated. This tool can be
    used for non-angular translation constructs like the Jade templates.
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    ab27330 View commit details
    Browse the repository at this point in the history
  36. Updates after review comments

    Updates for review comments:
    elastic#7545 (review)
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    53ef6bb View commit details
    Browse the repository at this point in the history
  37. Update after review comments

    Update for review comments:
    elastic#7545 (review)
    
    To be done:
    - Update of unit tests for UI and server
    - Call of verify translations
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    59d4e5f View commit details
    Browse the repository at this point in the history
  38. Update unit tests after review changes

    There was a number of changes to the i18n module and the ui i18n wrapper
    following review comments. This commit is to update the unit tests with
    respect.
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    c766d95 View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    be6ab1b View commit details
    Browse the repository at this point in the history
  40. Configuration menu
    Copy the full SHA
    7aaebc8 View commit details
    Browse the repository at this point in the history
  41. Update verify translations to test registered translations

    It was testing the static translation files. It is now updated to
    test the translations registered when Kibana server is started and
    the plugins have initialized.
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    c34637f View commit details
    Browse the repository at this point in the history
  42. Update after review comments

    Updates following review comments:
    elastic#7545 (review)
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    c3e5227 View commit details
    Browse the repository at this point in the history
  43. Update after review

    This commit contain updates after the following review:
    elastic#7545 (review)
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    dd934bf View commit details
    Browse the repository at this point in the history
  44. Updates after review

    Updates for review comments:
    elastic#7545 (review)
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    fa580f7 View commit details
    Browse the repository at this point in the history
  45. Update after review

    Updates for the following review comments:
    elastic#7545 (review)
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    cfb7b36 View commit details
    Browse the repository at this point in the history
  46. Update after review

    Updates after the following review comments:
    elastic#7545 (review)
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    a792f97 View commit details
    Browse the repository at this point in the history
  47. Configuration menu
    Copy the full SHA
    a2bee9f View commit details
    Browse the repository at this point in the history
  48. Update after rebase with master

    Loading message changed following merge of commit
    elastic@26c53e8#diff-e25d7fee746a4f249e17f87c02fd95f8R55
    This required update to the welcome message and how it is called.
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    d2174ca View commit details
    Browse the repository at this point in the history
  49. Update following review

    Updated the following review comments:
    elastic#7545 (review)
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    096c47d View commit details
    Browse the repository at this point in the history
  50. Update the algorithm to return the locale

    The algorithm to return which locale to use for translations based on the user
    locale list and the regsitered locales is updated in this commit. The algorithm
    previously did an exact match on all the user locales first before (by priority)
    then checking for best case match. The algorithm is now modified to check each
    user locale starting with the highest priority first for an exact match and then
    for best case match. If no match it then moves to the next user locale with
    the next highest priority. This is to follow the priority list that a user
    browser is configured for where there maybe a locale translation available
    but might not be the exact match with regard to the locale code and/or script.
    An example of this is that the highest priority locale of the user is 'en-US'
    but the locale translation available is 'en'. It is better select the 'en'
    locale rather than select the next highest locale which is an exact match.
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    0e167ca View commit details
    Browse the repository at this point in the history
  51. Update after review comments

    Updates after the following reviews:
    elastic#7545 (review)
    elastic#7545 (review)
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    1a83249 View commit details
    Browse the repository at this point in the history
  52. Fix after merge with master

    Change in the flo and layout of ui index meant that acceptLanguages were not
    being passed. This commit is an update to fix this so that the welcome
    messages are loaded.
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    286e200 View commit details
    Browse the repository at this point in the history
  53. Update after review comments

    This commit is for updates after the following review:
    elastic#7545 (review)
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    a8c6dc3 View commit details
    Browse the repository at this point in the history
  54. Fix issue when unit test run in CI as core translations are registered

    When unit tests are run on a test server (like in the CI), it will start
    Kibana server and register the core translations. This means that the i18n
    unit tests need to be able to store the existing registration prior to
    testing and replace after testing.
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    3b1ea3b View commit details
    Browse the repository at this point in the history
  55. [server/ui] move i18n into ui module

    spalger authored and hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    56a4e28 View commit details
    Browse the repository at this point in the history
  56. Configuration menu
    Copy the full SHA
    423ad53 View commit details
    Browse the repository at this point in the history
  57. Configuration menu
    Copy the full SHA
    a97037b View commit details
    Browse the repository at this point in the history
  58. Configuration menu
    Copy the full SHA
    a10a4f6 View commit details
    Browse the repository at this point in the history
  59. Configuration menu
    Copy the full SHA
    f2d6096 View commit details
    Browse the repository at this point in the history
  60. Update i18n module to a class

    Moving the i18n module into a class so as to encapsulate the registered
    translations which means there can be different and distinct instances per process.
    This is to accomodate the user case where there might be multiple Kibana server
    instances in a process and the localization should be at the server level.
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    02b2ab8 View commit details
    Browse the repository at this point in the history
  61. Configuration menu
    Copy the full SHA
    d190815 View commit details
    Browse the repository at this point in the history
  62. Remove redundant translation from core translation file

    Message starting with 'Give me a moment...' is no longer part of loading
    message folowing a rebase with master.
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    3d48799 View commit details
    Browse the repository at this point in the history
  63. Configuration menu
    Copy the full SHA
    078bde9 View commit details
    Browse the repository at this point in the history
  64. Configuration menu
    Copy the full SHA
    9e01026 View commit details
    Browse the repository at this point in the history
  65. Update after review comments

    - Update after following review: elastic#7545 (review)
    - Also, fix syntax mess following rebase with master of src/optimize/index.js
    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    53db1a2 View commit details
    Browse the repository at this point in the history
  66. Fix rebase with master error

    hickeyma committed Dec 13, 2016
    Configuration menu
    Copy the full SHA
    2b36753 View commit details
    Browse the repository at this point in the history
  67. Configuration menu
    Copy the full SHA
    c6265ee View commit details
    Browse the repository at this point in the history

Commits on Dec 14, 2016

  1. Fix lint errors

    hickeyma committed Dec 14, 2016
    Configuration menu
    Copy the full SHA
    b1fe29d View commit details
    Browse the repository at this point in the history