16.0.1 • Published 29 days ago

@talend/locales-tui-components v16.0.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
29 days ago

TUI-components locales

This module contains i18n files for TUI-components project.

How to install

yarn add @talend/locales-tui-components 

or

npm install @talend/locales-tui-components

How to use with i18next

Synchronous use

i18n.js

import i18n from 'i18next';

import merge from 'lodash/merge';

import { namespaces as tuicomponentsNamespaces } from '@talend/locales-tui-components/namespaces';
import { locales as tuicomponentsLocales } from '@talend/locales-tui-components/locales';

i18n
	.init({
		ns: [
			...tuicomponentsNamespaces,
			...myProjectNamespaces
		],
		resources: merge(tuicomponentsLocales, 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-components/locales', to: 'assets/locales' },
		]),
	]
}

i18n.js

import i18n from 'i18next';
import XHR from 'i18next-xhr-backend';

import { namespaces as tuicomponentsNamespaces } from '@talend/locales-tui-components/namespaces';

i18n
	.use(XHR)
	.init({
		ns: [
			...tuicomponentsNamespaces,
			...myProjectNamespaces
		],
		backend: {
			loadPath: '/assets/locales/{{lng}}/{{ns}}.json',
		},
	});

export default i18n;
16.0.1

29 days ago

11.4.5

7 months ago

9.5.0

1 year ago

6.44.11

2 years ago

6.42.1

2 years ago

6.42.3

2 years ago

6.42.2

2 years ago

6.41.1

3 years ago

6.40.2

3 years ago

6.41.0

3 years ago

6.39.5

3 years ago