-
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.
Update translation plugin template for the change in how translations…
… are published
- Loading branch information
Showing
8 changed files
with
44 additions
and
38 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <kibana_root>/plugins, changing the directory name to your plugin name. | ||
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. Edit <plugin_name>/package, updating the 'name' field to your plugin name. | ||
5. Restart the Kibana server to publish your plugin translations. |
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,13 @@ | ||
import { resolve } from 'path'; | ||
|
||
export default function (kibana) { | ||
return new kibana.Plugin({ | ||
id: 'kibana-es', | ||
|
||
uiExports: { | ||
translations: [ | ||
resolve(__dirname, './translations/es.json') | ||
] | ||
} | ||
}); | ||
} |
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,4 @@ | ||
{ | ||
"name": "kibana-es", | ||
"version": "kibana" | ||
} |
4 changes: 4 additions & 0 deletions
4
src/fixtures/translation_plugin_template/translations/es.json
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,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." | ||
} |