7028a88efd
* 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
* 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>
* Updated i18n core plugin APIs to be asynchronous
To be done:
- Better error handling in APIs
- Fix threading issue with storePluginLanguageTranslations API
* Fix thread synchroization issue in storePluginLanguageTranslations
* Update error handling in i18n core plugin
* Change to use NodeJS mkdirp function for creating directories recursively
Updates with review comments from @srl295. Changed export syntax to show the
exported functions at end of file.
* 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
* Add algorithm for determining plugin language when retrieving translations
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
* Add API to return all registered plugin language translations
* Add HAPI API to get all plugins translation files
* 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
* Update API test
* Add eslint fix for API test
* Update with review comments
From review https://github.com/elastic/kibana/pull/7545#issuecomment-231147435
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.
* Update after review comments
From review (https://github.com/elastic/kibana/pull/7545#issuecomment-231884490):
- 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 (https://github.com/elastic/kibana/issues/6515#issuecomment-231400097):
- Removed API as will consider in later phase
TODO:
- Make write function async
* Update after review comments
Updated write function to be asynchronous
* 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.
* 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.
* 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
* 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.
* 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.
* Replace registering of translations at plugin install time to the plugin init phase
This change follows review comments in:
https://github.com/elastic/kibana/issues/6515#issuecomment-236237218
* Update after review comments
Comments:
- https://github.com/elastic/kibana/pull/7545#discussion-diff-72890673
- https://github.com/elastic/kibana/pull/7545#discussion-diff-72894762
* 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:
https://github.com/elastic/kibana/pull/7562
* 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.
* Update review comments
This commit contains the following review comments:
- https://github.com/elastic/kibana/pull/7545#discussion-diff-74661282
- https://github.com/elastic/kibana/pull/7545#discussion-diff-74661392
- https://github.com/elastic/kibana/pull/7545#discussion-diff-74662271
- https://github.com/elastic/kibana/pull/7545#discussion-diff-74663235
- https://github.com/elastic/kibana/pull/7545#discussion-diff-74669201
- https://github.com/elastic/kibana/pull/7545#discussion-diff-74669269
- https://github.com/elastic/kibana/pull/7545#discussion-diff-74669419
- https://github.com/elastic/kibana/pull/7545#discussion-diff-74669628
- https://github.com/elastic/kibana/pull/7545#discussion-diff-74799382
* Update review comments
The following review comments are included in the commit:
- https://github.com/elastic/kibana/pull/7545#discussion_r74663515
- https://github.com/elastic/kibana/pull/7545#discussion_r74666995
- https://github.com/elastic/kibana/pull/7545#discussion_r74805552
* 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:
- https://github.com/elastic/kibana/pull/7545#discussion_r74662598
- https://github.com/elastic/kibana/pull/7545#discussion_r74669327
- https://github.com/elastic/kibana/pull/7545#discussion_r74669765
* Update accept-language-parser module to 1.2.0
Module version 1.2.0 fixes issue:
https://github.com/opentable/accept-language-parser/issues/8
This commit updates review comments:
https://github.com/elastic/kibana/pull/7545#discussion-diff-75525214
https://github.com/elastic/kibana/pull/7545#issuecomment-240290461
* 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:
- https://github.com/elastic/kibana/pull/7545#discussion-diff-74669970
* 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:
- https://github.com/elastic/kibana/pull/7545#discussion-diff-74804791
- https://github.com/elastic/kibana/pull/7545#discussion-diff-74801802
- https://github.com/elastic/kibana/pull/7545#discussion-diff-74670457
* 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:
- https://github.com/elastic/kibana/pull/7545#issuecomment-239202583
- https://github.com/elastic/kibana/pull/7545#issuecomment-239203734
* Add unit tests for the i18n UI wrapper functions
* Fix issues after rebase with master
* 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.
* Updates after review comments
Updates for review comments:
https://github.com/elastic/kibana/pull/7545#pullrequestreview-3748114
* Update after review comments
Update for review comments:
https://github.com/elastic/kibana/pull/7545#pullrequestreview-3937958
To be done:
- Update of unit tests for UI and server
- Call of verify translations
* 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.
* Add build task for verify translations
* Update the kibana i18n IDs to be prefixed with kibana
* 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.
* Update after review comments
Updates following review comments:
https://github.com/elastic/kibana/pull/7545#pullrequestreview-5529711
* Update after review
This commit contain updates after the following review:
https://github.com/elastic/kibana/pull/7545#pullrequestreview-5707951
* Updates after review
Updates for review comments:
https://github.com/elastic/kibana/pull/7545#pullrequestreview-6656571
* Update after review
Updates for the following review comments:
https://github.com/elastic/kibana/pull/7545#pullrequestreview-6911265
* Update after review
Updates after the following review comments:
https://github.com/elastic/kibana/pull/7545#pullrequestreview-7084765
* Update unit tests to use expect throwError
* Update after rebase with master
Loading message changed following merge of commit
|
||
---|---|---|
.. | ||
build | ||
config | ||
utils | ||
check_added_filenames.js | ||
check_plugins.js | ||
collect_files_to_commit.js | ||
eslint.js | ||
jenkins.js | ||
licenses.js | ||
lint_staged_files.js | ||
plugin.js | ||
precommit.js | ||
reject_rej_files.js | ||
release.js | ||
release_packages.js | ||
setup_kibana.js | ||
sterilize.js | ||
test.js |