terra-i18n
Advanced tools
Comparing version 4.38.1 to 4.39.0
@@ -5,5 +5,10 @@ # Changelog | ||
## 4.39.0 - (December 7, 2022) | ||
* Changed | ||
* Minor dependency version bump | ||
## 4.38.1 - (January 4, 2022) | ||
* Changed | ||
* Changed | ||
* Migrate docs to terra-core-docs. | ||
@@ -10,0 +15,0 @@ |
@@ -18,7 +18,4 @@ "use strict"; | ||
}); | ||
var _I18nProvider = _interopRequireDefault(require("./I18nProvider")); | ||
var _i18nLoader = _interopRequireDefault(require("./i18nLoader")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -7,11 +7,6 @@ "use strict"; | ||
exports.default = void 0; | ||
var _intlLoaders = _interopRequireDefault(require("./intlLoaders")); | ||
var _translationsLoaders = _interopRequireDefault(require("./translationsLoaders")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
var permitParams = function permitParams(callback) { | ||
@@ -22,5 +17,5 @@ if (typeof callback !== 'function') { | ||
}; | ||
var _default = function _default(locale, callback, scope) { | ||
permitParams(callback); | ||
/** | ||
@@ -32,5 +27,3 @@ * Use try-catch to check if Intl is provided by the browser. In some instances checking Intl will throw an | ||
*/ | ||
var hasIntl; | ||
try { | ||
@@ -42,7 +35,5 @@ // eslint-disable-next-line compat/compat | ||
} | ||
if (!hasIntl) { | ||
require('intl'); | ||
} | ||
if (global.IntlPolyfill) { | ||
@@ -55,3 +46,2 @@ /** | ||
*/ | ||
/* eslint-disable no-underscore-dangle */ | ||
@@ -63,11 +53,7 @@ if (Intl.__disableRegExpRestore && typeof Intl.__disableRegExpRestore === 'function') { | ||
(0, _intlLoaders.default)(locale); | ||
} | ||
(0, _translationsLoaders.default)(locale, callback, scope); | ||
}; | ||
/* eslint-enable global-require, import/no-named-as-default */ | ||
exports.default = _default; |
@@ -7,11 +7,6 @@ "use strict"; | ||
exports.default = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _reactIntl = require("react-intl"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var propTypes = { | ||
@@ -22,3 +17,2 @@ /** | ||
children: _propTypes.default.node.isRequired, | ||
/** | ||
@@ -28,3 +22,2 @@ * The locale name. | ||
locale: _propTypes.default.string.isRequired, | ||
/** | ||
@@ -35,7 +28,6 @@ * Translations messages object. | ||
}; | ||
var I18nProvider = function I18nProvider(_ref) { | ||
var children = _ref.children, | ||
locale = _ref.locale, | ||
messages = _ref.messages; | ||
locale = _ref.locale, | ||
messages = _ref.messages; | ||
return /*#__PURE__*/_react.default.createElement(_reactIntl.IntlProvider, { | ||
@@ -47,5 +39,4 @@ locale: locale, | ||
}; | ||
I18nProvider.propTypes = propTypes; | ||
var _default = I18nProvider; | ||
exports.default = _default; |
@@ -7,11 +7,6 @@ "use strict"; | ||
exports.loadIntl = exports.default = void 0; | ||
var _intlLoaders = _interopRequireDefault(require("intlLoaders")); | ||
var _intlLocalesSupported = _interopRequireDefault(require("intl-locales-supported")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
var supportedIntlConstructors = function supportedIntlConstructors() { | ||
@@ -25,3 +20,2 @@ /** | ||
var constructors; | ||
try { | ||
@@ -45,6 +39,4 @@ if ((typeof Intl === "undefined" ? "undefined" : _typeof(Intl)) === 'object' && typeof Intl.DateTimeFormat === 'function' && typeof Intl.NumberFormat === 'function') { | ||
} | ||
return constructors; | ||
}; | ||
var loadFallbackIntl = function loadFallbackIntl(localeContext) { | ||
@@ -55,3 +47,2 @@ try { | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -64,6 +55,4 @@ console.warn("Locale data was not supplied for the ".concat(localeContext, ". Using en data as the fallback locale data.")); | ||
}; | ||
var loadIntl = function loadIntl(locale) { | ||
var fallbackLocale = locale.split('-').length > 1 ? locale.split('-')[0] : false; | ||
try { | ||
@@ -79,3 +68,2 @@ if (!(0, _intlLocalesSupported.default)([locale], supportedIntlConstructors())) { | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -90,3 +78,2 @@ console.warn("Locale data was not supplied for the ".concat(locale, " locale. Using ").concat(fallbackLocale, " data as the fallback locale data.")); | ||
var _localeContext = "".concat(locale, " locale"); | ||
loadFallbackIntl(_localeContext); | ||
@@ -96,7 +83,5 @@ } | ||
}; | ||
exports.loadIntl = loadIntl; | ||
var _default = loadIntl; | ||
/* eslint-enable import/no-unresolved, compat/compat, no-console */ | ||
exports.default = _default; |
@@ -7,12 +7,9 @@ "use strict"; | ||
exports.default = void 0; | ||
var _translationsLoaders = _interopRequireDefault(require("translationsLoaders")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* eslint-disable import/no-unresolved, no-console */ | ||
/* eslint-disable import/no-unresolved, no-console */ | ||
var loadFallbackLocale = function loadFallbackLocale(localeContext, callback, scope) { | ||
try { | ||
_translationsLoaders.default.en(callback, scope); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -25,6 +22,4 @@ console.warn("Translations were not supplied for the ".concat(localeContext, ". Using en as the fallback locale.")); | ||
}; | ||
var loadTranslations = function loadTranslations(locale, callback, scope) { | ||
var fallbackLocale = locale.split('-').length > 1 ? locale.split('-')[0] : false; | ||
try { | ||
@@ -36,3 +31,2 @@ _translationsLoaders.default[locale](callback, scope); | ||
_translationsLoaders.default[fallbackLocale](callback, scope); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -47,3 +41,2 @@ console.warn("Translations were not supplied for the ".concat(locale, " locale. Using ").concat(fallbackLocale, " as the fallback locale.")); | ||
var _localeContext = "".concat(locale, " locale"); | ||
loadFallbackLocale(_localeContext, callback, scope); | ||
@@ -53,6 +46,4 @@ } | ||
}; | ||
var _default = loadTranslations; | ||
/* eslint-enable import/no-unresolved, no-console */ | ||
exports.default = _default; |
{ | ||
"name": "terra-i18n", | ||
"main": "lib/I18n.js", | ||
"version": "4.38.1", | ||
"version": "4.39.0", | ||
"description": "The terra-i18n package provides on-demand internationalization of React components.", | ||
@@ -46,3 +46,3 @@ "repository": { | ||
}, | ||
"gitHead": "2b761729af5655a49c1f1cf8b6f4130d57f4ae30" | ||
"gitHead": "421b2643a58e6de628aa789a9cdd0778b0a942a2" | ||
} |
@@ -36,3 +36,3 @@ # Terra I18n | ||
See the [documentation](https://engineering.cerner.com/terra-ui/components/terra-i-18-n/i-18-n/i-18-n). | ||
See the [documentation](https://engineering.cerner.com/terra-ui/components/cerner-terra-core-docs/i-18-n/about). | ||
@@ -39,0 +39,0 @@ ## LICENSE |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
60694