Fixes various syntax and rendering errors that might include: * Fixing broken images * Hardcoding book-level substitution values * Fixing incorrectly closed blocks (admonitions, tab sets, code blocks, dropdowns etc.) * Fixing poorly migrated complex tables * Fixing poorly migrated lists * Fixing poorly migrated tab sets * Removing inline text formatting from directive titles where they won't be rendered (for example, inline `code` formatting in dropdown titles) * Specifying if a version is trying to communicate if a feature was added, deprecated, or coming (for example, during migration `deprecated:[8.15.0]` became `[8.15.0]`, which doesn't give any information about _what_ happened in 8.15.0) * Note: I used an `{admonition}` for this, but you can change it to prose or some other kind of admonition if you want. * Fixing nested dropdowns / definition lists * Fixing poorly migrated footnotes * Updating references to prerelease `9.0.0` versions (using a repo-level substitution until there is a solution to https://github.com/elastic/docs-builder/issues/737) Links to pages that were updated: | Before | After | |---|---| | https://www.elastic.co/docs/extend/kibana/development-documentation | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/extend/development-documentation | | https://www.elastic.co/docs/extend/kibana/development-security | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/extend/development-security | | https://www.elastic.co/docs/extend/kibana/development-tests | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/extend/development-tests | | https://www.elastic.co/docs/extend/kibana/external-plugin-functional-tests | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/extend/external-plugin-functional-tests | | https://www.elastic.co/docs/extend/kibana/external-plugin-localization | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/extend/external-plugin-localization | | https://www.elastic.co/docs/extend/kibana/interpreting-ci-failures | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/extend/interpreting-ci-failures | | https://www.elastic.co/docs/extend/kibana/plugin-list | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/extend/plugin-list | | https://www.elastic.co/docs/extend/kibana/sample-data | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/extend/sample-data | | https://www.elastic.co/docs/extend/kibana/saved-objects-service | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/extend/saved-objects-service | | https://www.elastic.co/docs/extend/kibana/sharing-saved-objects | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/extend/sharing-saved-objects | | https://www.elastic.co/docs/extend/kibana/stability | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/extend/stability | | https://www.elastic.co/docs/reference/kibana/advanced-settings | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/reference/advanced-settings | | https://www.elastic.co/docs/reference/kibana/configuration-reference/ai-assistant-settings | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/reference/configuration-reference/ai-assistant-settings | | https://www.elastic.co/docs/reference/kibana/configuration-reference/fleet-settings | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/reference/configuration-reference/fleet-settings | | https://www.elastic.co/docs/reference/kibana/configuration-reference/general-settings | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/reference/configuration-reference/general-settings | | https://www.elastic.co/docs/reference/kibana/configuration-reference/monitoring-settings | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/reference/configuration-reference/monitoring-settings | | https://www.elastic.co/docs/reference/kibana/configuration-reference/reporting-settings | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/reference/configuration-reference/reporting-settings | | https://www.elastic.co/docs/reference/kibana/configuration-reference/task-manager-settings | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/reference/configuration-reference/task-manager-settings | | https://www.elastic.co/docs/reference/kibana/connectors-kibana/cases-webhook-action-type | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/reference/connectors-kibana/cases-webhook-action-type | | https://www.elastic.co/docs/reference/kibana/connectors-kibana/email-action-type | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/reference/connectors-kibana/email-action-type | | https://www.elastic.co/docs/reference/kibana/connectors-kibana/pre-configured-connectors | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/reference/connectors-kibana/pre-configured-connectors | | https://www.elastic.co/docs/reference/kibana/connectors-kibana/servicenow-action-type | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/reference/connectors-kibana/servicenow-action-type | | https://www.elastic.co/docs/reference/kibana/connectors-kibana/servicenow-itom-action-type | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/reference/connectors-kibana/servicenow-itom-action-type | | https://www.elastic.co/docs/reference/kibana/connectors-kibana/servicenow-sir-action-type | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/reference/connectors-kibana/servicenow-sir-action-type | | https://www.elastic.co/docs/reference/kibana/connectors-kibana/thehive-action-type | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/reference/connectors-kibana/thehive-action-type | | https://www.elastic.co/docs/reference/kibana/connectors-kibana/webhook-action-type | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/reference/connectors-kibana/webhook-action-type | | https://www.elastic.co/docs/reference/kibana/kibana-audit-events | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/reference/kibana-audit-events | | https://www.elastic.co/docs/reference/kibana/kibana-plugins | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/reference/kibana-plugins | | https://www.elastic.co/docs/release-kibana/notes/index | https://docs-v3-preview.elastic.dev/elastic/kibana/pull/218883/release-notes/index | --------- Co-authored-by: wajihaparvez <wajiha.parvez@elastic.co>
4.7 KiB
Localization for plugins outside the Kibana repo [external-plugin-localization]
To introduce localization for your plugin, use our i18n tool to create IDs and default messages. You can then extract these IDs with respective default messages into localization JSON files for {{kib}} to use when running your plugin.
Adding localization to your plugin [_adding_localization_to_your_plugin]
You must add a translations
directory at the root of your plugin. This directory will contain the translation files that {{kib}} uses.
.
├── translations
│ ├── en.json
│ ├── ja-JP.json
│ └── zh-CN.json
└── .i18nrc.json
Using {{kib}} i18n tooling [_using_kib_i18n_tooling]
To simplify the localization process, {{kib}} provides tools for the following functions:
- Verify all translations have translatable strings and extract default messages from templates
- Verify translation files and integrate them into {{kib}}
To use {{kib}} i18n tooling, create a .i18nrc.json
file with the following configs:
paths
. The directory from which the i18n translation IDs are extracted.exclude
. The list of files to exclude while parsing paths.translations
. The list of translations where JSON localizations are found.
{
"paths": {
"myPlugin": "src/ui",
},
"exclude": [
],
"translations": [
"translations/zh-CN.json",
"translations/ja-JP.json"
]
}
An example {{kib}} .i18nrc.json
is here.
Full documentation about i18n tooling is here.
Extracting default messages [_extracting_default_messages]
To extract the default messages from your plugin, run the following command:
node scripts/i18n_extract --output-dir ./translations --include-config ../kibana-extra/myPlugin/.i18nrc.json
This outputs a en.json
file inside the translations
directory. To localize other languages, clone the file and translate each string.
Checking i18n messages [_checking_i18n_messages]
Checking i18n does the following:
-
Checks all existing labels for violations.
-
Takes translations from
.i18nrc.json
and compares them to the messages extracted and validated.- Checks for unused translations. If you remove a label that has a corresponding translation, you must also remove the label from the translations file.
- Checks for incompatible translations. If you add or remove a new parameter from an existing string, you must also remove the label from the translations file.
To check your i18n translations, run the following command:
node scripts/i18n_check --fix --include-config ../kibana-extra/myPlugin/.i18nrc.json
Implementing i18n in the UI [_implementing_i18n_in_the_ui]
{{kib}} relies on ReactJS and requires localization in different environments (browser and NodeJS). The internationalization engine is framework agnostic and consumable in all parts of {{kib}} (ReactJS, and NodeJS).
To simplify internationalization in React, an additional abstraction is built around the I18n engine using React-intl for React.
i18n for vanilla JavaScript [_i18n_for_vanilla_javascript]
import { i18n } from '@kbn/i18n';
export const HELLO_WORLD = i18n.translate('hello.wonderful.world', {
defaultMessage: 'Greetings, planet Earth!',
});
Full details are here.
i18n for React [_i18n_for_react]
To localize strings in React, use either FormattedMessage
or i18n.translate
.
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
export const Component = () => {
return (
<div>
{i18n.translate('xpack.someText', { defaultMessage: 'Some text' })}
<FormattedMessage id="xpack.someOtherText" defaultMessage="Some other text">
</FormattedMessage>
</div>
);
};
Full details are here.
Resources [_resources]
To learn more about i18n tooling, see i18n dev tooling.
To learn more about implementing i18n in the UI, use the following links: