react-i18nify
Advanced tools
Comparing version 1.6.1 to 1.6.2
@@ -27,2 +27,4 @@ 'use strict'; | ||
var handleMissingTranslation = _formatMissingTranslation2.default; /* eslint no-underscore-dangle: "off" */ | ||
exports.default = { | ||
@@ -33,2 +35,3 @@ _localeKey: 'en', | ||
_getLocale: null, | ||
_handleMissingTranslation: handleMissingTranslation, | ||
@@ -87,2 +90,8 @@ get _translations() { | ||
}, | ||
setHandleMissingTranslation: function setHandleMissingTranslation(fn) { | ||
if (typeof fn !== 'function') { | ||
throw new Error('Handle missing translation must be a function'); | ||
} | ||
this._handleMissingTranslation = fn; | ||
}, | ||
t: function t(key) { | ||
@@ -119,3 +128,3 @@ var replacements = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
} catch (err) { | ||
return (0, _formatMissingTranslation2.default)(key); | ||
return this._handleMissingTranslation(key); | ||
} | ||
@@ -171,2 +180,2 @@ return this._replace(translation, replacements); | ||
} | ||
}; /* eslint no-underscore-dangle: "off" */ | ||
}; |
{ | ||
"name": "react-i18nify", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"description": "Simple i18n translation and localization components and helpers for React applications.", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
@@ -9,2 +9,4 @@ /* eslint no-underscore-dangle: "off" */ | ||
const handleMissingTranslation = formatMissingTranslation; | ||
export default { | ||
@@ -15,2 +17,3 @@ _localeKey: 'en', | ||
_getLocale: null, | ||
_handleMissingTranslation: handleMissingTranslation, | ||
@@ -67,3 +70,8 @@ get _translations() { | ||
}, | ||
setHandleMissingTranslation(fn) { | ||
if (typeof fn !== 'function') { | ||
throw new Error('Handle missing translation must be a function'); | ||
} | ||
this._handleMissingTranslation = fn; | ||
}, | ||
t(key, replacements = {}) { | ||
@@ -103,3 +111,3 @@ return this._translate(key, replacements); | ||
} catch (err) { | ||
return formatMissingTranslation(key); | ||
return this._handleMissingTranslation(key); | ||
} | ||
@@ -106,0 +114,0 @@ return this._replace(translation, replacements); |
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
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
30043
594