Skip to content

Commit

Permalink
Add boilerplate plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
hickeyma committed Jan 13, 2017
1 parent 840df9a commit fcd4c18
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/fixtures/i18n_plugin_template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 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.
4 changes: 4 additions & 0 deletions src/fixtures/i18n_plugin_template/i18n/es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"management-title": "administración",
"management-version": "versión"
}
11 changes: 11 additions & 0 deletions src/fixtures/i18n_plugin_template/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { resolve } from 'path';

export default function (kibana) {
return new kibana.Plugin({
require: ['i18n'],

init(server, options) {
server.plugins.i18n.registerTranslations(resolve(__dirname, 'i18n'));
}
});
};
4 changes: 4 additions & 0 deletions src/fixtures/i18n_plugin_template/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "management-es",
"version": "kibana"
}

0 comments on commit fcd4c18

Please sign in to comment.