Skip to content

Commit

Permalink
Add build task for verify translations
Browse files Browse the repository at this point in the history
  • Loading branch information
hickeyma committed Oct 19, 2016
1 parent 420fc62 commit 7659d30
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 50 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
"event-stream": "3.3.2",
"expect.js": "0.3.1",
"faker": "1.1.0",
"glob-promise": "1.0.6",
"grunt": "1.0.1",
"grunt-aws-s3": "0.14.5",
"grunt-babel": "5.0.1",
Expand Down
50 changes: 0 additions & 50 deletions src/ui/__tests__/ui_i18n_keys.js

This file was deleted.

1 change: 1 addition & 0 deletions tasks/build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = function (grunt) {
'_build:babelOptions',
'_build:plugins',
'_build:data',
'_build:verifyTranslations',
'_build:packageJson',
'_build:readme',
'_build:babelCache',
Expand Down
19 changes: 19 additions & 0 deletions tasks/build/verify_translations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import i18nVerify from '../../src/core_plugins/i18n/server/tool/i18n_verify_keys';
import fromRoot from '../../src/utils/from_root';

module.exports = function (grunt) {
grunt.registerTask('_build:verifyTranslations', function () {
const parsePaths = [fromRoot('/src/ui/views/*.jade')];
const translationFiles = fromRoot('/src/core_plugins/kibana/i18n/en.json');
const keyPattern = 'i18n\\(\'(.*)\'\\)';
const keyPatternRegEx = new RegExp(keyPattern, 'g');

i18nVerify.verifyTranslationKeys(parsePaths, translationFiles, keyPatternRegEx).then(function (keysNotTranslated) {
if (keysNotTranslated && Object.keys(keysNotTranslated).length > 0) {
console.error('Verification of the following translations keys are not translated: ', keysNotTranslated);
} else {
console.log('Verification of translations keys are a success.');
}
});
});
};

0 comments on commit 7659d30

Please sign in to comment.