mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Add build task to generate core plugin translations
Task which calls registerTranslations API and then a task which copies the regsitered translations to <kibana_root>/build/kibana
This commit is contained in:
parent
10db4585bd
commit
4957173794
5 changed files with 54 additions and 0 deletions
27
tasks/build/copy_translations.js
Normal file
27
tasks/build/copy_translations.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
import fs from 'fs';
|
||||
import fse from 'fs-extra';
|
||||
import i18nPlugin from '../../src/plugins/i18n/server/i18n/index';
|
||||
import Promise from 'bluebird';
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('_build:copy_translations', function () {
|
||||
const rootDir = grunt.config.get('root');
|
||||
const buildTranslationsDir = rootDir + '/build/kibana/fixtures/translations';
|
||||
const translationStoreDir = rootDir + '/fixtures/translations';
|
||||
|
||||
this.requires('_build:register_translations');
|
||||
|
||||
grunt.file.mkdir(buildTranslationsDir);
|
||||
|
||||
let done = this.async();
|
||||
let result = true;
|
||||
fse.copy(translationStoreDir, buildTranslationsDir, function (err) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
result = false;
|
||||
}
|
||||
done(result);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
@ -12,6 +12,7 @@ module.exports = function (grunt) {
|
|||
'_build:babelOptions',
|
||||
'_build:plugins',
|
||||
'_build:data',
|
||||
'_build:register_translations',
|
||||
'_build:packageJson',
|
||||
'_build:readme',
|
||||
'_build:babelCache',
|
||||
|
@ -22,6 +23,7 @@ module.exports = function (grunt) {
|
|||
'stop:optimizeBuild',
|
||||
'_build:versionedLinks',
|
||||
'_build:osShellScripts',
|
||||
'_build:copy_translations',
|
||||
grunt.option('skip-archives') ? [] : ['_build:archives'],
|
||||
grunt.option('skip-os-packages') ? [] : [
|
||||
'_build:pleaseRun',
|
||||
|
|
25
tasks/build/register_core_plugin_translation.js
Normal file
25
tasks/build/register_core_plugin_translation.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
import fs from 'fs';
|
||||
import i18nPlugin from '../../src/plugins/i18n/server/i18n/index';
|
||||
import Promise from 'bluebird';
|
||||
|
||||
const readdir = Promise.promisify(fs.readdir);
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('_build:register_translations', function () {
|
||||
const rootDir = grunt.config.get('root');
|
||||
|
||||
//Add translation dirs for the core plugins here
|
||||
const corePluginTranslationDirs = [rootDir + '/src/ui/i18n'];
|
||||
|
||||
Promise.map(corePluginTranslationDirs, (dir) => {
|
||||
readdir(dir).then((dirListing) => {
|
||||
Promise.map(dirListing, (listing) => {
|
||||
const fullFilePath = dir + '/' + listing;
|
||||
i18nPlugin.registerTranslations(fullFilePath);
|
||||
});
|
||||
});
|
||||
}).nodeify(this.async());
|
||||
});
|
||||
|
||||
};
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue