[7.x] Document scripts/i18n_check. (#32207)

This commit is contained in:
Aleh Zasypkin 2019-02-28 17:48:12 +02:00 committed by GitHub
parent c2c8f9d878
commit a8253de5b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 0 deletions

View file

@ -271,6 +271,9 @@ ReactDOM.render(
);
```
There is a number of tools was created to support internationalization in Kibana that would allow one to validate internationalized labels,
extract them to a `JSON` file or integrate translations back to Kibana. To know more, please read corresponding [readme](src/dev/i18n/README.md) file.
### Testing and Building
To ensure that your changes will not break other functionality, please run the test suite and build process before submitting your Pull Request.

View file

@ -203,3 +203,36 @@ integrating translations to has changed and some translations are not needed any
### Output
Unless `--target` is specified, the tool generates locale files in plugin folders and few other special locations based on namespaces and corresponding mappings defined in [.i18nrc.json](../../../.i18nrc.json).
## Validation tool
### Description
The tool performs a number of checks on internationalized labels and verifies whether they don't conflict with the existing translations.
### Notes
We don't catch every possible misuse of i18n framework, but only the most common and critical ones.
To perform translations compatibility checks tool relies on existing translations referenced in `translations` section of [.i18nrc.json](../../../.i18nrc.json).
Currently auto-fixer (`--fix`) can only automatically fix two types of errors, and for both of them the fix is just removing of conflicting translation entries from JSON files:
* incompatible translation - this error means that the value references in internationalized label differ from the ones
in the existing translation
* unused translation - this error means that the translations file includes label that doesn't exist anymore.
### Usage
```bash
node scripts/i18n_check --fix
```
* `--fix` tells the tool to try to fix as much violations as possible. All errors that tool won't be able to fix will be reported.
* `--ignore-incompatible` specifies whether tool should ignore incompatible translations.
* `--ignore-missing` specifies whether tool should ignore missing translations.
* `--ignore-unused` specifies whether tool should ignore unused translations.
* `--include-config` specifies additional paths to `.i18nrc.json` files (may be useful for 3rd-party plugins)