Skip to content

Commit

Permalink
Rename kbn-i18n to osd-i18n (#37) (#48)
Browse files Browse the repository at this point in the history
Signed-off-by: Bishoy Boktor <boktorbb@amazon.com>
  • Loading branch information
boktorbb committed Mar 4, 2021
1 parent c0b7292 commit e24d6ba
Show file tree
Hide file tree
Showing 47 changed files with 76 additions and 76 deletions.
118 changes: 59 additions & 59 deletions packages/kbn-i18n/GUIDELINE.md → packages/osd-i18n/GUIDELINE.md

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions packages/kbn-i18n/README.md → packages/osd-i18n/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# I18n

Kibana relies on several UI frameworks (ReactJS and AngularJS) and
OpenSearch Dashboards relies on several UI frameworks (ReactJS and AngularJS) and
requires localization in different environments (browser and NodeJS).
Internationalization engine is framework agnostic and consumable in
all parts of Kibana (ReactJS, AngularJS and NodeJS). In order to simplify
all parts of OpenSearch Dashboards (ReactJS, AngularJS and NodeJS). In order to simplify
internationalization in UI frameworks, the additional abstractions are
built around the I18n engine: `react-intl` for React and custom
components for AngularJS. [React-intl](https://github.com/yahoo/react-intl)
Expand All @@ -21,7 +21,7 @@ are used in order to simplify message location search. For example, if
we are going to translate the title of `/management/sections/objects/_objects.html`
file, we should use message path like this: `'management.objects.objectsTitle'`.

Each Kibana plugin has a separate folder with translation files located at
Each OpenSearch Dashboards plugin has a separate folder with translation files located at
```
{path/to/plugin}/translations/{locale}.json
```
Expand All @@ -30,13 +30,13 @@ where `locale` is [ISO 639 language code](https://en.wikipedia.org/wiki/List_of_

For example:
```
src/legacy/core_plugins/kibana/translations/fr.json
src/legacy/core_plugins/opensearch-dashboards/translations/fr.json
```

The engine scans `x-pack/legacy/plugins/*/translations`, `src/core_plugins/*/translations`, `plugins/*/translations` and `src/legacy/ui/translations` folders on initialization, so there is no need to register translation files.

The engine uses a `config/kibana.yml` file for locale resolution process. If locale is
defined via `i18n.locale` option in `config/kibana.yml` then it will be used as a base
The engine uses a `config/opensearch_dashboards.yml` file for locale resolution process. If locale is
defined via `i18n.locale` option in `config/opensearch_dashboards.yml` then it will be used as a base
locale, otherwise i18n engine will fall back to `en`. The `en` locale will also be used
if translation can't be found for the base non-English locale.

Expand Down Expand Up @@ -439,6 +439,6 @@ In order to translate attributes in AngularJS we should use `i18nFilter`:

In order to simplify localization process, some additional tools were implemented:
- tool for verifying all translations have translatable strings and extracting default messages from templates
- tool for verifying translation files and integrating them to Kibana
- tool for verifying translation files and integrating them to OpenSearch Dashboards

[I18n tools documentation](../../src/dev/i18n/README.md)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
module.exports = {
env: {
web: {
presets: ['@kbn/babel-preset/webpack_preset'],
presets: ['@osd/babel-preset/webpack_preset'],
},
node: {
presets: ['@kbn/babel-preset/node_preset'],
presets: ['@osd/babel-preset/node_preset'],
},
},
ignore: ['**/*.test.ts', '**/*.test.tsx'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@kbn/i18n",
"name": "@osd/i18n",
"browser": "./target/web/browser.js",
"main": "./target/node/index.js",
"types": "./target/types/index.d.ts",
Expand All @@ -8,14 +8,14 @@
"private": true,
"scripts": {
"build": "node scripts/build",
"kbn:bootstrap": "node scripts/build --source-maps",
"kbn:watch": "node scripts/build --watch --source-maps"
"osd:bootstrap": "node scripts/build --source-maps",
"osd:watch": "node scripts/build --watch --source-maps"
},
"devDependencies": {
"@babel/cli": "^7.10.5",
"@babel/core": "^7.11.6",
"@kbn/babel-preset": "1.0.0",
"@kbn/dev-utils": "1.0.0",
"@osd/babel-preset": "1.0.0",
"@osd/dev-utils": "1.0.0",
"@types/intl-relativeformat": "^2.1.0",
"@types/react-intl": "^2.3.15",
"del": "^5.1.0",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const { resolve } = require('path');

const del = require('del');
const supportsColor = require('supports-color');
const { run, withProcRunner } = require('@kbn/dev-utils');
const { run, withProcRunner } = require('@osd/dev-utils');

const ROOT_DIR = resolve(__dirname, '..');
const BUILD_DIR = resolve(ROOT_DIR, 'target');
Expand Down Expand Up @@ -82,7 +82,7 @@ run(
});
},
{
description: 'Simple build tool for @kbn/i18n package',
description: 'Simple build tool for @osd/i18n package',
flags: {
boolean: ['watch', 'source-maps'],
help: `
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export function init(newTranslation?: Translation) {
* @param translationsUrl URL pointing to the JSON bundle with translations.
*/
export async function load(translationsUrl: string) {
// Once this package is integrated into core Kibana we should switch to an abstraction
// Once this package is integrated into core OpenSearch Dashboards we should switch to an abstraction
// around `fetch` provided by the platform, e.g. `kfetch`.
const response = await fetch(translationsUrl, {
credentials: 'same-origin',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit e24d6ba

Please sign in to comment.