-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add build task for verify translations
- Loading branch information
Showing
4 changed files
with
21 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.'); | ||
} | ||
}); | ||
}); | ||
}; |