diff --git a/src/fixtures/i18n_plugin_template/README.md b/src/fixtures/i18n_plugin_template/README.md deleted file mode 100644 index add99685454496..00000000000000 --- a/src/fixtures/i18n_plugin_template/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# management-es - -A Kibana translation plugin structure. - -The main goal is to keep the plugin extremely simple so non-technical translators will have no trouble -creating new translations for Kibana. Everything except for the translations themselves can be generated -automatically with some enhancements to the Kibana plugin generator. The generator would only need a -plugin name and a list of one or more languages the user wants to create translations for. - -The default plugin init function will register all translation files in the plugin's root level i18n directory. -For more advanced plugins that might have a different directory structure, this default is configurable by modifying -the init function. - -Translation files are broken up by language and must have names that match IETF BCP 47 language codes. -Each translation file contains a single flat object with translation strings matched to their unique keys. Keys are -prefixed with plugin names and a dash to ensure uniqueness between plugins. A translation plugin is not restricted to -providing translations only for itself, the provided translations can cover other plugins as well. -For example, this plugin shows how a third party plugin might provide spanish translations for the Kibana core "management" -app, which is itself a separate plugin. diff --git a/src/fixtures/i18n_plugin_template/i18n/es.json b/src/fixtures/i18n_plugin_template/i18n/es.json deleted file mode 100644 index 2bd3529652d269..00000000000000 --- a/src/fixtures/i18n_plugin_template/i18n/es.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "management-title": "administración", - "management-version": "versión" -} diff --git a/src/fixtures/i18n_plugin_template/index.js b/src/fixtures/i18n_plugin_template/index.js deleted file mode 100644 index d2d1bacd37a298..00000000000000 --- a/src/fixtures/i18n_plugin_template/index.js +++ /dev/null @@ -1,11 +0,0 @@ -import { resolve } from 'path'; - -export default function (kibana) { - return new kibana.Plugin({ - require: ['i18n'], - - init(server, options) { - server.plugins.i18n.registerTranslations(resolve(__dirname, 'i18n')); - } - }); -}; diff --git a/src/fixtures/i18n_plugin_template/package.json b/src/fixtures/i18n_plugin_template/package.json deleted file mode 100644 index 52479fcd44ba36..00000000000000 --- a/src/fixtures/i18n_plugin_template/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "management-es", - "version": "kibana" -} diff --git a/src/fixtures/translation_plugin_template/README.md b/src/fixtures/translation_plugin_template/README.md new file mode 100644 index 00000000000000..2929654484ab9b --- /dev/null +++ b/src/fixtures/translation_plugin_template/README.md @@ -0,0 +1,23 @@ +A Kibana translation plugin structure. + +The main goal is to keep the plugin extremely simple so non-technical translators will have no trouble +creating new translations for Kibana. Everything except for the translations themselves can be generated +automatically with some enhancements to the Kibana plugin generator. The generator would only need a +plugin name and a list of one or more languages the user wants to create translations for. + +The plugin exports its translation file(s) on the server when it it starts up. This is achieved by publishing the files +via 'uiExports'.This is configurable by modifying the 'translations' item in the 'uiExports'. + +Translation files are broken up by language and must have names that match IETF BCP 47 language codes. +Each translation file contains a single flat object with translation strings matched to their unique keys. Keys are +prefixed with plugin names and a dash to ensure uniqueness between plugins. A translation plugin is not restricted to +providing translations only for itself, the provided translations can cover other plugins as well. + +For example, this template plugin shows how a third party plugin might provide spanish translations for the Kibana core "kibana" app, which is itself a separate plugin. + +To manually create a translation plugin using this template, follow these steps: + 1. Copy this template directory to /plugins, changing the directory name to your plugin name. + 2. Add your translations files to /translations directory. Remove/Overwrite the existing translation file (i.e. 'es.json'). + 3. Edit /index.js, updating the 'translations' item as per your plugin translations. + 4. Edit /package, updating the 'name' field to your plugin name. + 5. Restart the Kibana server to publish your plugin translations. diff --git a/src/fixtures/translation_plugin_template/index.js b/src/fixtures/translation_plugin_template/index.js new file mode 100644 index 00000000000000..1e139ee463916d --- /dev/null +++ b/src/fixtures/translation_plugin_template/index.js @@ -0,0 +1,13 @@ +import { resolve } from 'path'; + +export default function (kibana) { + return new kibana.Plugin({ + id: 'kibana-es', + + uiExports: { + translations: [ + resolve(__dirname, './translations/es.json') + ] + } + }); +} diff --git a/src/fixtures/translation_plugin_template/package.json b/src/fixtures/translation_plugin_template/package.json new file mode 100644 index 00000000000000..e747c010ede4ee --- /dev/null +++ b/src/fixtures/translation_plugin_template/package.json @@ -0,0 +1,4 @@ +{ + "name": "kibana-es", + "version": "kibana" +} diff --git a/src/fixtures/translation_plugin_template/translations/es.json b/src/fixtures/translation_plugin_template/translations/es.json new file mode 100644 index 00000000000000..9506d55ab54759 --- /dev/null +++ b/src/fixtures/translation_plugin_template/translations/es.json @@ -0,0 +1,4 @@ +{ + "UI-WELCOME_MESSAGE": "Cargando Kibana", + "UI-WELCOME_ERROR": "Kibana no se cargó correctamente. Heck la salida del servidor para obtener más información." +}