Skip to content
This repository was archived by the owner on Nov 17, 2017. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/generators/app/templates/TRANSLATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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 create a translation plugin using this template, follow these steps:
1. Generate the plugin using the generator
2. Add your translations files to <plugin_name>/translations directory. Remove/Overwrite the existing translation file (i.e. 'es.json').
3. Edit <plugin_name>/index.js, updating the 'translations' item as per your plugin translations.
4. Restart the Kibana server to publish your plugin translations.
4 changes: 4 additions & 0 deletions src/generators/app/templates/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<% if (generateApp) { %>import { resolve } from 'path';<% } %>
<% if (generateApi) { %>import exampleRoute from './server/routes/example';<% } %>

export default function (kibana) {
Expand All @@ -11,6 +12,9 @@ export default function (kibana) {
description: '<%= description %>',
main: 'plugins/<%= name %>/app'
},
translations: [
resolve(__dirname, './translations/es.json')
],
<% } %>
<% if (generateHack) { %>
hacks: [
Expand Down
4 changes: 4 additions & 0 deletions src/generators/app/templates/translations/es.json
Original file line number Diff line number Diff line change
@@ -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."
}