From 31d4c10f58f4a110fb25f2f3cbc77316c6925029 Mon Sep 17 00:00:00 2001 From: Aliaksandr Yankouski Date: Mon, 16 Jul 2018 17:02:06 +0300 Subject: [PATCH] Split i18n engine to specific parts by tech and by env (#20513) * split to packages in accordance to specific library * split to packages depending on tech and environment * make env modules names consistent * remove intl polyfilling * move laoder to root, i18n folder to core --- packages/kbn-i18n/README.md | 17 ++++------------- packages/kbn-i18n/angular/package.json | 4 ++++ packages/kbn-i18n/package.json | 4 ++-- packages/kbn-i18n/react/package.json | 4 ++++ packages/kbn-i18n/src/angular/provider.js | 2 +- .../kbn-i18n/src/{browser.js => core/index.js} | 11 ++--------- packages/kbn-i18n/src/index.js | 6 ++---- packages/kbn-i18n/src/{core => }/loader.js | 2 +- packages/kbn-i18n/src/react/provider.js | 2 +- src/ui/public/i18n/index.js | 6 ++---- 10 files changed, 23 insertions(+), 35 deletions(-) create mode 100644 packages/kbn-i18n/angular/package.json create mode 100644 packages/kbn-i18n/react/package.json rename packages/kbn-i18n/src/{browser.js => core/index.js} (75%) rename packages/kbn-i18n/src/{core => }/loader.js (99%) diff --git a/packages/kbn-i18n/README.md b/packages/kbn-i18n/README.md index 17d9032442d41..c037d10f403a7 100644 --- a/packages/kbn-i18n/README.md +++ b/packages/kbn-i18n/README.md @@ -192,9 +192,7 @@ uses I18n engine under the hood: ```js import React from 'react'; import ReactDOM from 'react-dom'; -import { ReactI18n } from '@kbn/i18n'; - -const { I18nProvider } = ReactI18n; +import { I18nProvider } from '@kbn/i18n/react'; ReactDOM.render( @@ -209,9 +207,7 @@ ReactDOM.render( After that we can use `FormattedMessage` components inside `RootComponent`: ```js import React, { Component } from 'react'; -import { ReactI18n } from '@kbn/i18n'; - -const { FormattedMessage } = ReactI18n; +import { FormattedMessage } from '@kbn/i18n/react'; class RootComponent extends Component { constructor(props) { @@ -259,9 +255,7 @@ React component as a pure function: ```js import React from 'react'; -import { ReactI18n } from '@kbn/i18n'; - -const { injectI18n, intlShape } = ReactI18n; +import { injectI18n, intlShape } from '@kbn/i18n/react'; const MyComponentContent = ({ intl }) => (