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

react-localize-redux

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-localize-redux - npm Package Compare versions

Comparing version 2.15.0 to 2.15.1

15

dist/ReactLocalizeRedux.js

@@ -282,3 +282,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

var translationsEqualSelector = exports.translationsEqualSelector = (0, _reselect.createSelectorCreator)(_reselect.defaultMemoize, function (cur, prev) {
var isTranslationsData = !(Array.isArray(cur) || Object.keys(cur).toString() === 'code,active');
var isTranslationsData = cur && !(Array.isArray(cur) || Object.keys(cur).toString() === 'code,active');

@@ -306,2 +306,7 @@ // for translations data use a combination of keys and values for comparison

var getTranslationsForActiveLanguage = exports.getTranslationsForActiveLanguage = translationsEqualSelector(getActiveLanguage, getLanguages, getTranslations, function (activeLanguage, languages, translations) {
// no active language found! return no translations
if (!activeLanguage) {
return {};
}
var activeLanguageCode = activeLanguage.code;

@@ -364,5 +369,9 @@

var scopedState = (state instanceof Map ? state.get(slice) : slice && state[slice]) || state;
var language = (0, _locale.getActiveLanguage)(scopedState);
var currentLanguage = language ? language.code : undefined;
var translate = (0, _locale.getTranslate)(scopedState);
return {
currentLanguage: (0, _locale.getActiveLanguage)(scopedState).code,
translate: (0, _locale.getTranslate)(scopedState)
currentLanguage: currentLanguage,
translate: translate
};

@@ -369,0 +378,0 @@ };

2

dist/ReactLocalizeRedux.min.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-redux"),require("redux")):"function"==typeof define&&define.amd?define(["react","react-redux","redux"],t):"object"==typeof exports?exports.ReactLocalizeRedux=t(require("react"),require("react-redux"),require("redux")):e.ReactLocalizeRedux=t(e.React,e.ReactRedux,e.Redux)}(this,function(e,t,n){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1];switch(t.type){case f:case p:var n=t.payload.options||{},r=t.payload.activeLanguage||n.defaultLanguage;return t.payload.languages.map(function(e,t){var n=function(e){return void 0!==r?e===r:0===t};return"string"==typeof e?{code:e,active:n(e)}:u({},e,{active:n(e.code)})});case v:return e.map(function(e){return e.code===t.payload.languageCode?u({},e,{active:!0}):u({},e,{active:!1})});default:return e}}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];switch(t.type){case g:var n=void 0!==t.translationTransform?t.translationTransform(t.payload.translation,t.languageCodes):t.payload.translation;return u({},e,(0,c.flatten)(n,{safe:!0}));case d:var a=t.languageCodes.indexOf(t.payload.language),o=a>=0?(0,c.flatten)(t.payload.translation):{},i=Object.keys(o).reduce(function(n,i){var c=t.languageCodes.map(function(t,n){var r=e[i]||[];return n===a?o[i]:r[n]});return u({},n,r({},i,c))},{});return u({},e,i);default:return e}}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y,t=arguments[1];switch(t.type){case f:var n=t.payload.options||{};return u({},e,(0,s.validateOptions)(n));default:return e}}Object.defineProperty(t,"__esModule",{value:!0}),t.getTranslate=t.getTranslationsForActiveLanguage=t.translationsEqualSelector=t.getActiveLanguage=t.getOptions=t.getLanguages=t.getTranslations=t.setActiveLanguage=t.setLanguages=t.addTranslationForLanguage=t.addTranslation=t.initialize=t.localeReducer=t.defaultTranslateOptions=t.TRANSLATE=t.SET_ACTIVE_LANGUAGE=t.SET_LANGUAGES=t.ADD_TRANSLATION_FOR_LANGUGE=t.ADD_TRANSLATION=t.INITIALIZE=void 0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.languages=a,t.translations=o,t.options=i;var c=(n(9),n(5)),l=n(7),s=n(4),f=t.INITIALIZE="@@localize/INITIALIZE",g=t.ADD_TRANSLATION="@@localize/ADD_TRANSLATION",d=t.ADD_TRANSLATION_FOR_LANGUGE="@@localize/ADD_TRANSLATION_FOR_LANGUGE",p=t.SET_LANGUAGES="@@localize/SET_LANGUAGES",v=t.SET_ACTIVE_LANGUAGE="@@localize/SET_ACTIVE_LANGUAGE",y=(t.TRANSLATE="@@localize/TRANSLATE",t.defaultTranslateOptions={renderInnerHtml:!0,showMissingTranslationMsg:!0,missingTranslationMsg:"Missing translation key ${ key } for language ${ code }"}),b={languages:[],translations:{},options:y},T=(t.localeReducer=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b,t=arguments[1],n=e.languages.map(function(e){return e.code}),r=e.options.translationTransform;return{languages:a(e.languages,t),translations:o(e.translations,u({},t,{languageCodes:n,translationTransform:r})),options:i(e.options,t)}},t.initialize=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y;return{type:f,payload:{languages:e,options:t}}},t.addTranslation=function(e){return{type:g,payload:{translation:e}}},t.addTranslationForLanguage=function(e,t){return{type:d,payload:{translation:e,language:t}}},t.setLanguages=function(e,t){return{type:p,payload:{languages:e,activeLanguage:t}}},t.setActiveLanguage=function(e){return{type:v,payload:{languageCode:e}}},t.getTranslations=function(e){return e.translations}),A=t.getLanguages=function(e){return e.languages},O=t.getOptions=function(e){return e.options},m=t.getActiveLanguage=function(e){return A(e).filter(function(e){return!0===e.active})[0]},L=t.translationsEqualSelector=(0,l.createSelectorCreator)(l.defaultMemoize,function(e,t){if(!(Array.isArray(e)||"code,active"===Object.keys(e).toString())){var n=t,r=e,a=Object.keys(n).toString(),o=Object.keys(r).toString();return a+" - "+(0,s.objectValuesToString)(n)==o+" - "+(0,s.objectValuesToString)(r)}return t===e}),j=t.getTranslationsForActiveLanguage=L(m,A,T,function(e,t,n){var a=e.code,o=(0,s.getIndexForLanguageCode)(a,t);return Object.keys(n).reduce(function(e,t){return u({},e,r({},t,n[t][o]))},{})});t.getTranslate=(0,l.createSelector)(j,m,O,function(e,t,n){return function(a){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=u({},n,i);if("string"==typeof a)return(0,s.getLocalizedElement)(a,e,o,t,c);if(Array.isArray(a))return a.reduce(function(n,a){return u({},n,r({},a,(0,s.getLocalizedElement)(a,e,o,t,c)))},{});throw new Error("react-localize-redux: Invalid key passed to getTranslate.")}})},function(t,n){t.exports=e},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.localize=void 0;var r=n(1),a=(function(e){e&&e.__esModule}(r),n(8)),o=n(0),i=function(e){return function(t){var n=(t instanceof Map?t.get(e):e&&t[e])||t;return{currentLanguage:(0,o.getActiveLanguage)(n).code,translate:(0,o.getTranslate)(n)}}};t.localize=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return(0,a.connect)(i(t))(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);Object.defineProperty(t,"localize",{enumerable:!0,get:function(){return r.localize}});var a=n(0);Object.defineProperty(t,"localeReducer",{enumerable:!0,get:function(){return a.localeReducer}}),Object.defineProperty(t,"initialize",{enumerable:!0,get:function(){return a.initialize}}),Object.defineProperty(t,"addTranslation",{enumerable:!0,get:function(){return a.addTranslation}}),Object.defineProperty(t,"addTranslationForLanguage",{enumerable:!0,get:function(){return a.addTranslationForLanguage}}),Object.defineProperty(t,"setLanguages",{enumerable:!0,get:function(){return a.setLanguages}}),Object.defineProperty(t,"setActiveLanguage",{enumerable:!0,get:function(){return a.setActiveLanguage}}),Object.defineProperty(t,"getTranslate",{enumerable:!0,get:function(){return a.getTranslate}}),Object.defineProperty(t,"getActiveLanguage",{enumerable:!0,get:function(){return a.getActiveLanguage}}),Object.defineProperty(t,"getLanguages",{enumerable:!0,get:function(){return a.getLanguages}}),Object.defineProperty(t,"getTranslations",{enumerable:!0,get:function(){return a.getTranslations}}),Object.defineProperty(t,"getOptions",{enumerable:!0,get:function(){return a.getOptions}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateOptions=t.objectValuesToString=t.getIndexForLanguageCode=t.templater=t.hasHtmlTags=t.getLocalizedElement=void 0;var r=n(1),a=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(0),i=(t.getLocalizedElement=function(e,t,n,r){var c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:o.defaultTranslateOptions,l=t[e]||function(){return c.missingTranslationCallback&&c.missingTranslationCallback(e,r.code),c.showMissingTranslationMsg?u(c.missingTranslationMsg,{key:e,code:r.code}):""}(),s=u(l,n);return c.renderInnerHtml&&i(s)?a.default.createElement("span",{dangerouslySetInnerHTML:{__html:s}}):s},t.hasHtmlTags=function(e){var t=/(&[^\s]*;|<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[\^'">\s]+))?)+\s*|\s*)\/?>)/;return e.search(t)>=0}),u=t.templater=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(var n in t){var r="\\${\\s*"+n+"\\s*}",a=new RegExp(r,"gmi");e=e.replace(a,t[n])}return e};t.getIndexForLanguageCode=function(e,t){return t.map(function(e){return e.code}).indexOf(e)},t.objectValuesToString=function(e){return Object.values?Object.values(e).toString():Object.keys(e).map(function(t){return e[t].toString()}).toString()},t.validateOptions=function(e){if(void 0!==e.translationTransform&&"function"!=typeof e.translationTransform)throw new Error("react-localize-redux: Invalid translationTransform function.");return e}},function(e,t,n){function r(e,t){function n(e,u,c){c=c||1,Object.keys(e).forEach(function(l){var s=e[l],f=t.safe&&Array.isArray(s),g=Object.prototype.toString.call(s),d=o(s),p="[object Object]"===g||"[object Array]"===g,v=u?u+r+l:l;if(!f&&!d&&p&&Object.keys(s).length&&(!t.maxDepth||c<a))return n(s,v,c+1);i[v]=s})}t=t||{};var r=t.delimiter||".",a=t.maxDepth,i={};return n(e),i}function a(e,t){function n(e){var t=Number(e);return isNaN(t)||-1!==e.indexOf(".")?e:t}t=t||{};var r=t.delimiter||".",i=t.overwrite||!1,u={};return o(e)||"[object Object]"!==Object.prototype.toString.call(e)?e:(Object.keys(e).forEach(function(o){for(var c=o.split(r),l=n(c.shift()),s=n(c[0]),f=u;void 0!==s;){var g=Object.prototype.toString.call(f[l]),d="[object Object]"===g||"[object Array]"===g;if(!i&&!d&&void 0!==f[l])return;(i&&!d||!i&&null==f[l])&&(f[l]="number"!=typeof s||t.object?{}:[]),f=f[l],c.length>0&&(l=n(c.shift()),s=n(c[0]))}f[l]=a(e[o],t)}),u)}var o=n(6);e.exports=r;r.flatten=r,r.unflatten=a},function(e,t){function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function r(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}/*!
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-redux"),require("redux")):"function"==typeof define&&define.amd?define(["react","react-redux","redux"],t):"object"==typeof exports?exports.ReactLocalizeRedux=t(require("react"),require("react-redux"),require("redux")):e.ReactLocalizeRedux=t(e.React,e.ReactRedux,e.Redux)}(this,function(e,t,n){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1];switch(t.type){case f:case p:var n=t.payload.options||{},r=t.payload.activeLanguage||n.defaultLanguage;return t.payload.languages.map(function(e,t){var n=function(e){return void 0!==r?e===r:0===t};return"string"==typeof e?{code:e,active:n(e)}:u({},e,{active:n(e.code)})});case v:return e.map(function(e){return e.code===t.payload.languageCode?u({},e,{active:!0}):u({},e,{active:!1})});default:return e}}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];switch(t.type){case g:var n=void 0!==t.translationTransform?t.translationTransform(t.payload.translation,t.languageCodes):t.payload.translation;return u({},e,(0,c.flatten)(n,{safe:!0}));case d:var a=t.languageCodes.indexOf(t.payload.language),o=a>=0?(0,c.flatten)(t.payload.translation):{},i=Object.keys(o).reduce(function(n,i){var c=t.languageCodes.map(function(t,n){var r=e[i]||[];return n===a?o[i]:r[n]});return u({},n,r({},i,c))},{});return u({},e,i);default:return e}}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y,t=arguments[1];switch(t.type){case f:var n=t.payload.options||{};return u({},e,(0,s.validateOptions)(n));default:return e}}Object.defineProperty(t,"__esModule",{value:!0}),t.getTranslate=t.getTranslationsForActiveLanguage=t.translationsEqualSelector=t.getActiveLanguage=t.getOptions=t.getLanguages=t.getTranslations=t.setActiveLanguage=t.setLanguages=t.addTranslationForLanguage=t.addTranslation=t.initialize=t.localeReducer=t.defaultTranslateOptions=t.TRANSLATE=t.SET_ACTIVE_LANGUAGE=t.SET_LANGUAGES=t.ADD_TRANSLATION_FOR_LANGUGE=t.ADD_TRANSLATION=t.INITIALIZE=void 0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.languages=a,t.translations=o,t.options=i;var c=(n(9),n(5)),l=n(7),s=n(4),f=t.INITIALIZE="@@localize/INITIALIZE",g=t.ADD_TRANSLATION="@@localize/ADD_TRANSLATION",d=t.ADD_TRANSLATION_FOR_LANGUGE="@@localize/ADD_TRANSLATION_FOR_LANGUGE",p=t.SET_LANGUAGES="@@localize/SET_LANGUAGES",v=t.SET_ACTIVE_LANGUAGE="@@localize/SET_ACTIVE_LANGUAGE",y=(t.TRANSLATE="@@localize/TRANSLATE",t.defaultTranslateOptions={renderInnerHtml:!0,showMissingTranslationMsg:!0,missingTranslationMsg:"Missing translation key ${ key } for language ${ code }"}),b={languages:[],translations:{},options:y},T=(t.localeReducer=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b,t=arguments[1],n=e.languages.map(function(e){return e.code}),r=e.options.translationTransform;return{languages:a(e.languages,t),translations:o(e.translations,u({},t,{languageCodes:n,translationTransform:r})),options:i(e.options,t)}},t.initialize=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y;return{type:f,payload:{languages:e,options:t}}},t.addTranslation=function(e){return{type:g,payload:{translation:e}}},t.addTranslationForLanguage=function(e,t){return{type:d,payload:{translation:e,language:t}}},t.setLanguages=function(e,t){return{type:p,payload:{languages:e,activeLanguage:t}}},t.setActiveLanguage=function(e){return{type:v,payload:{languageCode:e}}},t.getTranslations=function(e){return e.translations}),A=t.getLanguages=function(e){return e.languages},O=t.getOptions=function(e){return e.options},m=t.getActiveLanguage=function(e){return A(e).filter(function(e){return!0===e.active})[0]},L=t.translationsEqualSelector=(0,l.createSelectorCreator)(l.defaultMemoize,function(e,t){if(e&&!(Array.isArray(e)||"code,active"===Object.keys(e).toString())){var n=t,r=e,a=Object.keys(n).toString(),o=Object.keys(r).toString();return a+" - "+(0,s.objectValuesToString)(n)==o+" - "+(0,s.objectValuesToString)(r)}return t===e}),j=t.getTranslationsForActiveLanguage=L(m,A,T,function(e,t,n){if(!e)return{};var a=e.code,o=(0,s.getIndexForLanguageCode)(a,t);return Object.keys(n).reduce(function(e,t){return u({},e,r({},t,n[t][o]))},{})});t.getTranslate=(0,l.createSelector)(j,m,O,function(e,t,n){return function(a){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=u({},n,i);if("string"==typeof a)return(0,s.getLocalizedElement)(a,e,o,t,c);if(Array.isArray(a))return a.reduce(function(n,a){return u({},n,r({},a,(0,s.getLocalizedElement)(a,e,o,t,c)))},{});throw new Error("react-localize-redux: Invalid key passed to getTranslate.")}})},function(t,n){t.exports=e},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.localize=void 0;var r=n(1),a=(function(e){e&&e.__esModule}(r),n(8)),o=n(0),i=function(e){return function(t){var n=(t instanceof Map?t.get(e):e&&t[e])||t,r=(0,o.getActiveLanguage)(n);return{currentLanguage:r?r.code:void 0,translate:(0,o.getTranslate)(n)}}};t.localize=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return(0,a.connect)(i(t))(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);Object.defineProperty(t,"localize",{enumerable:!0,get:function(){return r.localize}});var a=n(0);Object.defineProperty(t,"localeReducer",{enumerable:!0,get:function(){return a.localeReducer}}),Object.defineProperty(t,"initialize",{enumerable:!0,get:function(){return a.initialize}}),Object.defineProperty(t,"addTranslation",{enumerable:!0,get:function(){return a.addTranslation}}),Object.defineProperty(t,"addTranslationForLanguage",{enumerable:!0,get:function(){return a.addTranslationForLanguage}}),Object.defineProperty(t,"setLanguages",{enumerable:!0,get:function(){return a.setLanguages}}),Object.defineProperty(t,"setActiveLanguage",{enumerable:!0,get:function(){return a.setActiveLanguage}}),Object.defineProperty(t,"getTranslate",{enumerable:!0,get:function(){return a.getTranslate}}),Object.defineProperty(t,"getActiveLanguage",{enumerable:!0,get:function(){return a.getActiveLanguage}}),Object.defineProperty(t,"getLanguages",{enumerable:!0,get:function(){return a.getLanguages}}),Object.defineProperty(t,"getTranslations",{enumerable:!0,get:function(){return a.getTranslations}}),Object.defineProperty(t,"getOptions",{enumerable:!0,get:function(){return a.getOptions}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateOptions=t.objectValuesToString=t.getIndexForLanguageCode=t.templater=t.hasHtmlTags=t.getLocalizedElement=void 0;var r=n(1),a=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(0),i=(t.getLocalizedElement=function(e,t,n,r){var c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:o.defaultTranslateOptions,l=t[e]||function(){return c.missingTranslationCallback&&c.missingTranslationCallback(e,r.code),c.showMissingTranslationMsg?u(c.missingTranslationMsg,{key:e,code:r.code}):""}(),s=u(l,n);return c.renderInnerHtml&&i(s)?a.default.createElement("span",{dangerouslySetInnerHTML:{__html:s}}):s},t.hasHtmlTags=function(e){var t=/(&[^\s]*;|<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[\^'">\s]+))?)+\s*|\s*)\/?>)/;return e.search(t)>=0}),u=t.templater=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(var n in t){var r="\\${\\s*"+n+"\\s*}",a=new RegExp(r,"gmi");e=e.replace(a,t[n])}return e};t.getIndexForLanguageCode=function(e,t){return t.map(function(e){return e.code}).indexOf(e)},t.objectValuesToString=function(e){return Object.values?Object.values(e).toString():Object.keys(e).map(function(t){return e[t].toString()}).toString()},t.validateOptions=function(e){if(void 0!==e.translationTransform&&"function"!=typeof e.translationTransform)throw new Error("react-localize-redux: Invalid translationTransform function.");return e}},function(e,t,n){function r(e,t){function n(e,u,c){c=c||1,Object.keys(e).forEach(function(l){var s=e[l],f=t.safe&&Array.isArray(s),g=Object.prototype.toString.call(s),d=o(s),p="[object Object]"===g||"[object Array]"===g,v=u?u+r+l:l;if(!f&&!d&&p&&Object.keys(s).length&&(!t.maxDepth||c<a))return n(s,v,c+1);i[v]=s})}t=t||{};var r=t.delimiter||".",a=t.maxDepth,i={};return n(e),i}function a(e,t){function n(e){var t=Number(e);return isNaN(t)||-1!==e.indexOf(".")?e:t}t=t||{};var r=t.delimiter||".",i=t.overwrite||!1,u={};return o(e)||"[object Object]"!==Object.prototype.toString.call(e)?e:(Object.keys(e).forEach(function(o){for(var c=o.split(r),l=n(c.shift()),s=n(c[0]),f=u;void 0!==s;){var g=Object.prototype.toString.call(f[l]),d="[object Object]"===g||"[object Array]"===g;if(!i&&!d&&void 0!==f[l])return;(i&&!d||!i&&null==f[l])&&(f[l]="number"!=typeof s||t.object?{}:[]),f=f[l],c.length>0&&(l=n(c.shift()),s=n(c[0]))}f[l]=a(e[o],t)}),u)}var o=n(6);e.exports=r;r.flatten=r,r.unflatten=a},function(e,t){function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function r(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}/*!
* Determine if an object is a Buffer

@@ -3,0 +3,0 @@ *

@@ -185,3 +185,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

export var translationsEqualSelector = createSelectorCreator(defaultMemoize, function (cur, prev) {
var isTranslationsData = !(Array.isArray(cur) || Object.keys(cur).toString() === 'code,active');
var isTranslationsData = cur && !(Array.isArray(cur) || Object.keys(cur).toString() === 'code,active');

@@ -209,2 +209,7 @@ // for translations data use a combination of keys and values for comparison

export var getTranslationsForActiveLanguage = translationsEqualSelector(getActiveLanguage, getLanguages, getTranslations, function (activeLanguage, languages, translations) {
// no active language found! return no translations
if (!activeLanguage) {
return {};
}
var activeLanguageCode = activeLanguage.code;

@@ -211,0 +216,0 @@

@@ -9,5 +9,9 @@ import React from 'react';

var scopedState = (state instanceof Map ? state.get(slice) : slice && state[slice]) || state;
var language = getActiveLanguage(scopedState);
var currentLanguage = language ? language.code : undefined;
var translate = getTranslate(scopedState);
return {
currentLanguage: getActiveLanguage(scopedState).code,
translate: getTranslate(scopedState)
currentLanguage: currentLanguage,
translate: translate
};

@@ -14,0 +18,0 @@ };

@@ -199,3 +199,3 @@ 'use strict';

var translationsEqualSelector = exports.translationsEqualSelector = (0, _reselect.createSelectorCreator)(_reselect.defaultMemoize, function (cur, prev) {
var isTranslationsData = !(Array.isArray(cur) || Object.keys(cur).toString() === 'code,active');
var isTranslationsData = cur && !(Array.isArray(cur) || Object.keys(cur).toString() === 'code,active');

@@ -223,2 +223,7 @@ // for translations data use a combination of keys and values for comparison

var getTranslationsForActiveLanguage = exports.getTranslationsForActiveLanguage = translationsEqualSelector(getActiveLanguage, getLanguages, getTranslations, function (activeLanguage, languages, translations) {
// no active language found! return no translations
if (!activeLanguage) {
return {};
}
var activeLanguageCode = activeLanguage.code;

@@ -225,0 +230,0 @@

@@ -21,5 +21,9 @@ 'use strict';

var scopedState = (state instanceof Map ? state.get(slice) : slice && state[slice]) || state;
var language = (0, _locale.getActiveLanguage)(scopedState);
var currentLanguage = language ? language.code : undefined;
var translate = (0, _locale.getTranslate)(scopedState);
return {
currentLanguage: (0, _locale.getActiveLanguage)(scopedState).code,
translate: (0, _locale.getTranslate)(scopedState)
currentLanguage: currentLanguage,
translate: translate
};

@@ -26,0 +30,0 @@ };

{
"name": "react-localize-redux",
"version": "2.15.0",
"version": "2.15.1",
"description": "Localization library for React/Redux",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

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