Skip to content

Integrate main i18n tool into build pipeline#22254

Merged
LeanidShutau merged 5 commits intoelastic:masterfrom
LeanidShutau:feature/integrate-i18n-tools
Aug 29, 2018
Merged

Integrate main i18n tool into build pipeline#22254
LeanidShutau merged 5 commits intoelastic:masterfrom
LeanidShutau:feature/integrate-i18n-tools

Conversation

@LeanidShutau
Copy link
Copy Markdown
Contributor

@LeanidShutau LeanidShutau commented Aug 22, 2018

Closes #20291

@LeanidShutau LeanidShutau added Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// Project:i18n backport pending v6.5.0 labels Aug 22, 2018
@LeanidShutau LeanidShutau self-assigned this Aug 22, 2018
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@azasypkin
Copy link
Copy Markdown
Contributor

Ugh, old test results disappeared, will retest to get new ones and check the output out.

@azasypkin
Copy link
Copy Markdown
Contributor

retest

Copy link
Copy Markdown
Contributor

@azasypkin azasypkin left a comment

Choose a reason for hiding this comment

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

Left one nit and one proposal, just to make i18nCheck task similar to other lint-like tasks.

err.style['background'] = '#F44336';
err.style['padding'] = '25px';
err.innerText = '{{i18n 'UI-WELCOME_ERROR' '{"defaultMessage": "Kibana did not load properly. Check the server output for more information."}'}}';
err.innerText = '{{i18n 'common.ui.welcomeError' '{"defaultMessage": "Kibana did not load properly. Check the server output for more information."}'}}';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: please update ids for all existing UI-WELCOME_ messages we have in Kibana (in knb-plugin-helpers tests) and remove src/ui/translations entirely for now.

export default function (grunt) {
grunt.registerTask('verifyTranslations', async function () {
module.exports = function (grunt) {
grunt.registerTask('verifyTranslations', function () {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

issue: hmm, can you please make run:i18nCheck task exactly like run:typeCheck (define in config/run.js, run it right after 'run:typeCheck' in jenkins:unit and test grunt tasks, with !grunt.option('quick') for the latter task)?

And let's rename scripts/extract_default_translations.js to scripts/i18n_check for now and later on we'll figure out whether to keep this name for extraction purpose or not.

Copy link
Copy Markdown

@yankouskia yankouskia left a comment

Choose a reason for hiding this comment

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

just 1 note

grunt.log.writeln(result);
resolve();
});
}).then(done, done);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It is likely more obsolete, I would use:

.then(done)
.catch(done)

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@azasypkin
Copy link
Copy Markdown
Contributor

retest

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Copy link
Copy Markdown
Contributor

@azasypkin azasypkin left a comment

Choose a reason for hiding this comment

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

Looks good!

  1. I still see one usage of verifyTranslations in tasks/test.js, please remove it and make sure we don't have any other leftovers
  2. While testing I've noticed that we misspelled message here:
    throw new Error(`Default message in <FormattedMessage> is not allowed ("${messageId}").`);
    , it should be Empty default message .... is not allowed .... instead of Default message ... is not allowed ...

@LeanidShutau, also let's wait for @spalger feedback before merging this.

Hey @spalger, could you please take a brief look at the PR and let us know if it looks ok to you? We're going to integrate Listr and other bells and whistles in the follow up, just need a bare minimum right now :)

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Copy link
Copy Markdown
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

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

Other than the replacement of the error handling from run() this looks good. Will try running it after that one thing is fixed.

outputFormat,
});
} catch (e) {
console.error(`${chalk.white.bgRed(' I18N ERROR ')} ${e.message || e}`);
Copy link
Copy Markdown
Contributor

@spalger spalger Aug 27, 2018

Choose a reason for hiding this comment

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

The run() function implements standardized failure handling, please don't override it as removing the stacktrace from unexpected errors can make them really hard to debug. If you have specific errors that don't require a stack trace please throw a FailError instead, like so:

import { createFailError } from '../run';
// ...
throw createFailError(`${chalk.white.bgRed(' I18N ERROR ')} some error message`);

run() will only print the error message from FailErrors and will print the stacktrace for other unexpected errors.

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@LeanidShutau LeanidShutau requested a review from spalger August 28, 2018 13:42
@spalger
Copy link
Copy Markdown
Contributor

spalger commented Aug 28, 2018

Thanks @LeanidShutau!

@LeanidShutau LeanidShutau merged commit 1e5d82c into elastic:master Aug 29, 2018
@LeanidShutau LeanidShutau deleted the feature/integrate-i18n-tools branch August 29, 2018 08:55
LeanidShutau added a commit to LeanidShutau/kibana that referenced this pull request Aug 29, 2018
* Integrate main i18n tool to build process

* Resolve comments

* Remove old task

* Replace default Error with FailError
LeanidShutau added a commit that referenced this pull request Aug 29, 2018
* Integrate main i18n tool to build process

* Resolve comments

* Remove old task

* Replace default Error with FailError
@LeanidShutau
Copy link
Copy Markdown
Contributor Author

6.x/6.5: b705fed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported Project:i18n Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// v6.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants