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

Integrate main i18n tool into build pipeline #22254

Merged

Conversation

LeanidShutau
Copy link
Contributor

@LeanidShutau LeanidShutau commented Aug 22, 2018

Closes #20291

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

💚 Build Succeeded

@azasypkin
Copy link
Member

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

@azasypkin
Copy link
Member

retest

Copy link
Member

@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.

@@ -33,7 +33,7 @@ window.onload = function () {
err.style['text-align'] = 'center';
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
Member

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
Member

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

@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);

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
Contributor

💔 Build Failed

@azasypkin
Copy link
Member

retest

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Member

@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
Contributor

💚 Build Succeeded

Copy link
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
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
Contributor

💚 Build Succeeded

@LeanidShutau LeanidShutau requested a review from spalger August 28, 2018 13:42
@spalger
Copy link
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
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 Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v6.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants