Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/ui/ui_render/bootstrap/template.js.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ window.onload = function () {
err.style['text-align'] = 'center';
err.style['background'] = '#F44336';
err.style['padding'] = '25px';
err.innerText = '{{i18n 'common.ui.welcomeError' '{"defaultMessage": "Kibana did not load properly. Check the server output for more information."}'}}';

document.body.innerHTML = err.outerHTML;
err.innerText = document.querySelector('[data-error-message]').dataset.errorMessage;
}

function loadStyleSheet(path) {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/ui_render/views/ui_app.pug
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ block content
.kibanaLoader
.kibanaWelcomeLogoCircle
.kibanaWelcomeLogo
.kibanaWelcomeText
.kibanaWelcomeText(data-error-message='#{i18n("UI-WELCOME_ERROR")}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: that's why CI is failing (https://kibana-ci.elastic.co/job/elastic+kibana+pull-request+multijob-intake/4504/console):

12:49:04 [10:49:04] →  I18N ERROR  Error in src/ui/ui_render/views/ui_app.pug
12:49:04 Error: Empty defaultMessage in i18n() or i18n.translate() is not allowed ("UI-WELCOME_ERROR").
12:49:04 ERROR  I18N ERROR  Error in src/ui/ui_render/views/ui_app.pug
12:49:04       Error: Empty defaultMessage in i18n() or i18n.translate() is not allowed ("UI-WELCOME_ERROR").

I guess you wanted to write something like this instead

.kibanaWelcomeText(data-error-message="#{i18n('common.ui.welcomeError', { defaultMessage: 'Kibana did not load properly. Check the server output for more information.' })}")`

Our tools now enforce default message for all labels that allows developers to actually see the real label content without looking into translation files. So we got rid of en.json entirely and extract all default messages automatically whenever translation vendors need them.

@pavel06081991 @maryia-lapata can you please help @srl295 to test this change (i.e where one should put and register test translation file for common.ui. etc.)? Essentially we need a localized version of this label that includes apostrophe.

Copy link
Contributor

@maryia-lapata maryia-lapata Oct 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srl295
As far as I understood, the code below doesn't really call function i18n

.kibanaWelcomeText(data-error-message="#{i18n('common.ui.welcomeErrorMessage', { defaultMessage: 'Kibana did not load properly. Check the server output for more information.' })}")

And the attribute value is displayed as it is:
image

If we change code to invoke i18n, like this:

.kibanaWelcomeText(data-error-message=i18n('common.ui.welcomeErrorMessage', { defaultMessage: 'Kibana did not load properly. Check the server output for more information.' }))

it will be rendered correctly (I checked with fr locale):
image
But i18n tool doesn't extract such message for now. @LeanidShutau just created PR #24006 to fix this.

In case you would like to check translations with custom locale, here the steps are:

  1. run command node scripts/i18n_check --output ./. It will generate en.json file with default translations and it place the file in the root folder.
  2. create fr.json file, copy translations from en.json, update messages in fr.json according to locale (you can just update one or several messages).
  3. point plugin to the translation file. For example, in src/core_plugins/kibana/index.js add path to fr.json file in translations array:
translations: [
	        require('path').resolve(__dirname, './../../../fr.json')
	      ],
  1. set up locale in config/kibana.yml by changing i18n.locale param. (i18n.locale: "fr")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @srl295! Please let us know if you need any help with this PR. We intend to ship fix for this issue in the 6.6 release, but If you don't have time that's fine too! Someone from the i18n team will just take it over.

| #{i18n('common.ui.welcomeMessage', { defaultMessage: 'Loading Kibana' })}

script(src=bootstrapScriptUrl)