Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

terra-i18n

Package Overview
Dependencies
Maintainers
10
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

terra-i18n - npm Package Compare versions

Comparing version 2.18.0 to 2.19.0

5

CHANGELOG.md

@@ -7,2 +7,7 @@ Changelog

2.18.0 - (August 29, 2018)
------------------
### Changed
* Minor dependency version bump
2.17.0 - (August 1, 2018)

@@ -9,0 +14,0 @@ ------------------

2

docs/DEPENDENCIES.md

@@ -14,3 +14,3 @@ # Dependency Information

| react-intl | ^2.4.0 | ^0.14.9 \|\| ^15.0.0 \|\| ^16.0.0 | Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations. |
| terra-doc-template | ^1.11.0 | ^16.2.0 | Provides an adjustable template for documentation pages. |
| terra-doc-template | ^1.12.0 | ^16.2.0 | Provides an adjustable template for documentation pages. |

@@ -17,0 +17,0 @@ ## devDependencies

@@ -71,3 +71,4 @@ 'use strict';

{ htmlFor: 'locale' },
' Current locale: ',
' ',
'Current locale:',
this.state.locale,

@@ -74,0 +75,0 @@ ' '

@@ -50,3 +50,4 @@ 'use strict';

),
' This is an example of a nested I18nProvider. The site overall is an example of using an application-level I18nProvider implemented through the terra-base component.'
' ',
'This is an example of a nested I18nProvider. The site overall is an example of using an application-level I18nProvider implemented through the terra-base component.'
),

@@ -53,0 +54,0 @@ example: _react2.default.createElement(_I18nDemo2.default, null)

@@ -19,4 +19,10 @@ 'use strict';

var _I18n = require('../../../I18n');
var _I18nProvider = require('../../../I18nProvider');
var _I18nProvider2 = _interopRequireDefault(_I18nProvider);
var _i18nLoader = require('../../../i18nLoader');
var _i18nLoader2 = _interopRequireDefault(_i18nLoader);
var _i18nSupportedLocales = require('../../../i18nSupportedLocales');

@@ -58,3 +64,3 @@

value: function componentDidMount() {
(0, _I18n.i18nLoader)(this.props.locale, this.setState, this);
(0, _i18nLoader2.default)(this.props.locale, this.setState, this);
}

@@ -65,3 +71,3 @@ }, {

this.setState({ selectedLocale: e.target.value });
(0, _I18n.i18nLoader)(e.target.value, this.setState, this);
(0, _i18nLoader2.default)(e.target.value, this.setState, this);
}

@@ -75,3 +81,3 @@ }, {

return _react2.default.createElement(
_I18n.I18nProvider,
_I18nProvider2.default,
{

@@ -78,0 +84,0 @@ locale: this.state.locale,

{
"name": "terra-i18n",
"main": "lib/I18n.js",
"version": "2.18.0",
"version": "2.19.0",
"description": "The terra-i18n package provides on-demand internationalization of React components.",

@@ -43,3 +43,3 @@ "repository": {

"react-intl": "^2.4.0",
"terra-doc-template": "^1.12.0"
"terra-doc-template": "^1.13.0"
},

@@ -46,0 +46,0 @@ "scripts": {

# Terra I18n
[![NPM version](http://img.shields.io/npm/v/terra-i18n.svg)](https://www.npmjs.org/package/terra-i18n)
[![Build Status](https://travis-ci.org/cerner/terra-core.svg?branch=master)](https://travis-ci.org/cerner/terra-core)
[![NPM version](https://badgen.net/npm/v/terra-i18n)](https://www.npmjs.org/package/terra-i18n)
[![Build Status](https://badgen.net/travis/cerner/terra-core)](https://travis-ci.org/cerner/terra-core)

@@ -7,0 +7,0 @@ The terra-i18n package provides on-demand internationalization of React components. Additionally, it provides an `aggregate-translations` pre-build tool to aggregate translations and build dynamic intlLoader and translationLoader modules.

@@ -10,13 +10,11 @@ const path = require('path');

translationDirectories.forEach(dir =>
// Check the directory for a translation file for each locale
locales.forEach((language) => {
const translationFile = path.resolve(dir, `${language}.json`);
try {
Object.assign(translations[language], JSON.parse(fs.readFileSync(translationFile, 'utf8')));
} catch (e) {
// eslint-disable-next-line no-console
console.warn(`Translation file ${language}.json not found for ${dir}`);
}
}));
translationDirectories.forEach(dir => locales.forEach((language) => {
const translationFile = path.resolve(dir, `${language}.json`);
try {
Object.assign(translations[language], JSON.parse(fs.readFileSync(translationFile, 'utf8')));
} catch (e) {
// eslint-disable-next-line no-console
console.warn(`Translation file ${language}.json not found for ${dir}`);
}
}));

@@ -23,0 +21,0 @@ return translations;

@@ -17,4 +17,3 @@ const path = require('path');

const customDirectories = (baseDirectory, directories) =>
(directories.map(dir => path.resolve(baseDirectory, dir)));
const customDirectories = (baseDirectory, directories) => (directories.map(dir => path.resolve(baseDirectory, dir)));

@@ -21,0 +20,0 @@ const aggregatedTranslations = (options) => {

@@ -1,119 +0,102 @@

const loadArIntl = () =>
require.ensure(
[],
require => require('intl/locale-data/jsonp/ar.js'),
'ar-intl-local',
);
const loadArIntl = () => require.ensure(
[],
require => require('intl/locale-data/jsonp/ar.js'),
'ar-intl-local',
);
const loadEnIntl = () =>
require.ensure(
[],
require => require('intl/locale-data/jsonp/en.js'),
'en-intl-local',
);
const loadEnIntl = () => require.ensure(
[],
require => require('intl/locale-data/jsonp/en.js'),
'en-intl-local',
);
const loadEnGBIntl = () =>
require.ensure(
[],
require => require('intl/locale-data/jsonp/en-GB.js'),
'en-GB-intl-local',
);
const loadEnGBIntl = () => require.ensure(
[],
require => require('intl/locale-data/jsonp/en-GB.js'),
'en-GB-intl-local',
);
const loadEnUSIntl = () =>
require.ensure(
[],
require => require('intl/locale-data/jsonp/en-US.js'),
'en-US-intl-local',
);
const loadEnUSIntl = () => require.ensure(
[],
require => require('intl/locale-data/jsonp/en-US.js'),
'en-US-intl-local',
);
const loadDeIntl = () =>
require.ensure(
[],
require => require('intl/locale-data/jsonp/de.js'),
'de-intl-local',
);
const loadDeIntl = () => require.ensure(
[],
require => require('intl/locale-data/jsonp/de.js'),
'de-intl-local',
);
const loadPtIntl = () =>
require.ensure(
[],
require => require('intl/locale-data/jsonp/pt.js'),
'pt-intl-local',
);
const loadPtIntl = () => require.ensure(
[],
require => require('intl/locale-data/jsonp/pt.js'),
'pt-intl-local',
);
const loadPtBRIntl = () =>
require.ensure(
[],
require => require('intl/locale-data/jsonp/pt-BR.js'),
'pt-BR-intl-local',
);
const loadPtBRIntl = () => require.ensure(
[],
require => require('intl/locale-data/jsonp/pt-BR.js'),
'pt-BR-intl-local',
);
const loadFrIntl = () =>
require.ensure(
[],
require => require('intl/locale-data/jsonp/fr.js'),
'fr-intl-local',
);
const loadFrIntl = () => require.ensure(
[],
require => require('intl/locale-data/jsonp/fr.js'),
'fr-intl-local',
);
const loadFrFRIntl = () =>
require.ensure(
[],
require => require('intl/locale-data/jsonp/fr-FR.js'),
'fr-FR-intl-local',
);
const loadFrFRIntl = () => require.ensure(
[],
require => require('intl/locale-data/jsonp/fr-FR.js'),
'fr-FR-intl-local',
);
const loadEsIntl = () =>
require.ensure(
[],
require => require('intl/locale-data/jsonp/es.js'),
'es-intl-local',
);
const loadEsIntl = () => require.ensure(
[],
require => require('intl/locale-data/jsonp/es.js'),
'es-intl-local',
);
const loadEsUSIntl = () =>
require.ensure(
[],
require => require('intl/locale-data/jsonp/es-US.js'),
'es-US-intl-local',
);
const loadEsUSIntl = () => require.ensure(
[],
require => require('intl/locale-data/jsonp/es-US.js'),
'es-US-intl-local',
);
const loadEsESIntl = () =>
require.ensure(
[],
require => require('intl/locale-data/jsonp/es-ES.js'),
'es-ES-intl-local',
);
const loadEsESIntl = () => require.ensure(
[],
require => require('intl/locale-data/jsonp/es-ES.js'),
'es-ES-intl-local',
);
const loadFiFIIntl = () =>
require.ensure(
[],
require => require('intl/locale-data/jsonp/fi-FI.js'),
'fi-FI-intl-local',
);
const loadFiFIIntl = () => require.ensure(
[],
require => require('intl/locale-data/jsonp/fi-FI.js'),
'fi-FI-intl-local',
);
const loadNlIntl = () =>
require.ensure(
[],
require => require('intl/locale-data/jsonp/nl.js'),
'nl-intl-local',
);
const loadNlIntl = () => require.ensure(
[],
require => require('intl/locale-data/jsonp/nl.js'),
'nl-intl-local',
);
const loadNlBEIntl = () =>
require.ensure(
[],
require => require('intl/locale-data/jsonp/nl-BE.js'),
'nl-BE-intl-local',
);
const loadNlBEIntl = () => require.ensure(
[],
require => require('intl/locale-data/jsonp/nl-BE.js'),
'nl-BE-intl-local',
);
const loadSvIntl = () =>
require.ensure(
[],
require => require('intl/locale-data/jsonp/sv.js'),
'sv-intl-local',
);
const loadSvIntl = () => require.ensure(
[],
require => require('intl/locale-data/jsonp/sv.js'),
'sv-intl-local',
);
const loadSvSEIntl = () =>
require.ensure(
[],
require => require('intl/locale-data/jsonp/sv-SE.js'),
'sv-SE-intl-local',
);
const loadSvSEIntl = () => require.ensure(
[],
require => require('intl/locale-data/jsonp/sv-SE.js'),
'sv-SE-intl-local',
);

@@ -120,0 +103,0 @@ const intlLoaders = {

@@ -36,3 +36,9 @@ import React from 'react';

<FormattedMessage id="Terra.ajax.error" />
<label htmlFor="locale"> Current locale: {this.state.locale} </label>
<label htmlFor="locale">
{' '}
Current locale:
{this.state.locale}
{' '}
</label>
<select value={this.state.locale} onChange={this.handleLocaleChange}>

@@ -39,0 +45,0 @@ <option value="en">en</option>

@@ -22,3 +22,9 @@ import React from 'react';

title: 'I18nProvider Example',
description: (<p style={{ fontStyle: 'italic' }}><span style={{ fontWeight: 'bold' }}>Note:</span> This is an example of a nested I18nProvider. The site overall is an example of using an application-level I18nProvider implemented through the terra-base component.</p>),
description: (
<p style={{ fontStyle: 'italic' }}>
<span style={{ fontWeight: 'bold' }}>Note:</span>
{' '}
This is an example of a nested I18nProvider. The site overall is an example of using an application-level I18nProvider implemented through the terra-base component.
</p>
),
example: <I18nDemo />,

@@ -25,0 +31,0 @@ },

@@ -5,3 +5,4 @@ import React from 'react';

import { I18nProvider, i18nLoader } from '../../../I18n';
import I18nProvider from '../../../I18nProvider';
import i18nLoader from '../../../i18nLoader';
import i18nSupportedLocales from '../../../i18nSupportedLocales';

@@ -46,3 +47,4 @@

</select>
<p><span style={{ fontWeight: 'bold' }}> Loaded locale message: </span>
<p>
<span style={{ fontWeight: 'bold' }}> Loaded locale message: </span>
<FormattedMessage id="Terra.ajax.error" />

@@ -49,0 +51,0 @@ </p>

@@ -76,4 +76,3 @@ /* globals spyOn */

const translationsFiles = [];
i18nSupportedLocales.forEach(locale =>
translationsFiles.push(expect.stringContaining(`aggregated-translations${path.sep}${locale}.js`)));
i18nSupportedLocales.forEach(locale => translationsFiles.push(expect.stringContaining(`aggregated-translations${path.sep}${locale}.js`)));

@@ -80,0 +79,0 @@ aggregateTranslations();

@@ -21,3 +21,3 @@ /* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */

try {
shallow(<I18nProvider messages={messages} ><Children /></I18nProvider>);
shallow(<I18nProvider messages={messages}><Children /></I18nProvider>);
} catch (e) {

@@ -30,3 +30,3 @@ expect(e.message).toContain('The prop `locale` is marked as required');

try {
shallow(<I18nProvider locale={locale} ><Children /></I18nProvider>);
shallow(<I18nProvider locale={locale}><Children /></I18nProvider>);
} catch (e) {

@@ -33,0 +33,0 @@ expect(e.message).toContain('The prop `messages` is marked as required');

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc