@talend/locales-tui-containers
v9.1.3
Published
This module contains i18n files for TUI-containers project.
Downloads
1,396
Readme
TUI-containers locales
This module contains i18n files for TUI-containers project.
How to install
yarn add @talend/locales-tui-containers
or
npm install @talend/locales-tui-containers
How to use with i18next
Synchronous use
i18n.js
import i18n from 'i18next';
import merge from 'lodash/merge';
import { namespaces as tuicontainersNamespaces } from '@talend/locales-tui-containers/namespaces';
import { locales as tuicontainersLocales } from '@talend/locales-tui-containers/locales';
i18n
.init({
ns: [
...tuicontainersNamespaces,
...myProjectNamespaces
],
resources: merge(tuicontainersLocales, myProjectLocales),
});
export default i18n;
Asynchronous use
For async load, you need to copy the i18n files to the location you want to serve them
webpack.config.js
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
plugins: [
new CopyWebpackPlugin([
{ from: 'node_modules/@talend/locales-tui-containers/locales', to: 'assets/locales' },
]),
]
}
i18n.js
import i18n from 'i18next';
import XHR from 'i18next-xhr-backend';
import { namespaces as tuicontainersNamespaces } from '@talend/locales-tui-containers/namespaces';
i18n
.use(XHR)
.init({
ns: [
...tuicontainersNamespaces,
...myProjectNamespaces
],
backend: {
loadPath: '/assets/locales/{{lng}}/{{ns}}.json',
},
});
export default i18n;