7.15.1 • Published 7 months ago

@talend/locales-design-system v7.15.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
7 months ago

design-system locales

This module contains i18n files for design-system project.

How to install

yarn add @talend/locales-design-system 

or

npm install @talend/locales-design-system

How to use with i18next

Synchronous use

i18n.js

import i18n from 'i18next';

import merge from 'lodash/merge';

import { namespaces as designsystemNamespaces } from '@talend/locales-design-system/namespaces';
import { locales as designsystemLocales } from '@talend/locales-design-system/locales';

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

i18n.js

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

import { namespaces as designsystemNamespaces } from '@talend/locales-design-system/namespaces';

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

export default i18n;
7.15.1

7 months ago

7.3.0

1 year ago

4.2.0

2 years ago

1.12.2

2 years ago

1.11.3

2 years ago

1.4.0

3 years ago