@tolgee/i18next
Advanced tools
Comparing version 5.33.2 to 5.33.3-prerelease.2efc0e6b.0
@@ -11,3 +11,3 @@ 'use strict'; | ||
if (i18n.getResourceBundle(language, namespace)) { | ||
i18n.addResourceBundle(language, namespace, Object.fromEntries(data), false, true); | ||
i18n.addResourceBundle(language, namespace, data instanceof Map ? Object.fromEntries(data) : data, false, true); | ||
} | ||
@@ -36,3 +36,5 @@ }); | ||
}); | ||
callback(null, translations ? Object.fromEntries(translations) : undefined); | ||
callback(null, translations instanceof Map | ||
? Object.fromEntries(translations) | ||
: translations); | ||
} | ||
@@ -119,3 +121,3 @@ catch (e) { | ||
const I18nextPlugin = () => (tolgee) => { | ||
tolgee.updateOptions({ ns: [], defaultNs: undefined }); | ||
tolgee.updateOptions({ autoLoadRequiredData: false }); | ||
return tolgee; | ||
@@ -122,0 +124,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@tolgee/web");const o=(e,o)=>{e.on("update",(()=>{e.getAllRecords().forEach((({language:e,namespace:t,data:n})=>{o.getResourceBundle(e,t)&&o.addResourceBundle(e,t,Object.fromEntries(n),!1,!0)}))})),o.on("languageChanged",(o=>{o&&e.getLanguage()!==o&&e.changeLanguage(o)})),o.tolgee=e},t=e=>({type:"backend",name:"TolgeeBackend",init(){},read:async function(o,t,n){try{const r=await e.loadRecord({language:o,namespace:t});n(null,r?Object.fromEntries(r):void 0)}catch(e){console.error(e),n(!0)}}}),n="tolgeeProcessor",r=e=>({type:"postProcessor",name:"tolgeeProcessor",process:function(o,t,n,r){var s,a,l,i,c,d;const u=null!==(l=null!==(s=n.keySeparator)&&void 0!==s?s:null===(a=null==r?void 0:r.options)||void 0===a?void 0:a.keySeparator)&&void 0!==l?l:".",{key:g,namespaces:p}=r.extractFromKey(t.join(u),n),v=null!==(c=null!==(i=null==p?void 0:p[0])&&void 0!==i?i:n.ns)&&void 0!==c?c:null===(d=null==r?void 0:r.options)||void 0===d?void 0:d.defaultNS;return e.wrap({key:g,defaultValue:n.defaultValue,translation:o,ns:v})}}),s=(e,o)=>{var t,r;let s;s="string"==typeof o.postProcess?[o.postProcess,n]:Array.isArray(o.postProcess)?[...o.postProcess,n]:[n];return Object.assign(Object.assign({},o),{postProcess:s,i18nFormat:Object.assign(Object.assign({},null==o?void 0:o.i18nFormat),{bindI18nStore:"added "+(null===(t=o.i18nFormat)||void 0===t?void 0:t.bindI18nStore)||""}),react:Object.assign(Object.assign({},null==o?void 0:o.react),{bindI18nStore:"added "+(null===(r=o.react)||void 0===r?void 0:r.bindI18nStore)||""})})};exports.I18nextPlugin=()=>e=>(e.updateOptions({ns:[],defaultNs:void 0}),e),exports.TOLGEE_PROCESSOR_NAME=n,exports.tolgeeApply=o,exports.tolgeeBackend=t,exports.tolgeeOptions=s,exports.tolgeeProcessor=r,exports.withTolgee=(e,n)=>{e.use(t(n)),e.use(r(n));const a=e.init;return e.init=(...t)=>{o(n,e);let r,l={};"object"==typeof t[0]?(l=t[0],r=t[1]):r=t[0];const i=s(0,l),c=a(i,r),d=e.language||l.lng;return d&&n.changeLanguage(d),n.run(),c},e},Object.keys(e).forEach((function(o){"default"===o||exports.hasOwnProperty(o)||Object.defineProperty(exports,o,{enumerable:!0,get:function(){return e[o]}})})); | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@tolgee/web");const o=(e,o)=>{e.on("update",(()=>{e.getAllRecords().forEach((({language:e,namespace:t,data:n})=>{o.getResourceBundle(e,t)&&o.addResourceBundle(e,t,n instanceof Map?Object.fromEntries(n):n,!1,!0)}))})),o.on("languageChanged",(o=>{o&&e.getLanguage()!==o&&e.changeLanguage(o)})),o.tolgee=e},t=e=>({type:"backend",name:"TolgeeBackend",init(){},read:async function(o,t,n){try{const r=await e.loadRecord({language:o,namespace:t});n(null,r instanceof Map?Object.fromEntries(r):r)}catch(e){console.error(e),n(!0)}}}),n="tolgeeProcessor",r=e=>({type:"postProcessor",name:"tolgeeProcessor",process:function(o,t,n,r){var a,s,l,i,c,u;const d=null!==(l=null!==(a=n.keySeparator)&&void 0!==a?a:null===(s=null==r?void 0:r.options)||void 0===s?void 0:s.keySeparator)&&void 0!==l?l:".",{key:g,namespaces:p}=r.extractFromKey(t.join(d),n),v=null!==(c=null!==(i=null==p?void 0:p[0])&&void 0!==i?i:n.ns)&&void 0!==c?c:null===(u=null==r?void 0:r.options)||void 0===u?void 0:u.defaultNS;return e.wrap({key:g,defaultValue:n.defaultValue,translation:o,ns:v})}}),a=(e,o)=>{var t,r;let a;a="string"==typeof o.postProcess?[o.postProcess,n]:Array.isArray(o.postProcess)?[...o.postProcess,n]:[n];return Object.assign(Object.assign({},o),{postProcess:a,i18nFormat:Object.assign(Object.assign({},null==o?void 0:o.i18nFormat),{bindI18nStore:"added "+(null===(t=o.i18nFormat)||void 0===t?void 0:t.bindI18nStore)||""}),react:Object.assign(Object.assign({},null==o?void 0:o.react),{bindI18nStore:"added "+(null===(r=o.react)||void 0===r?void 0:r.bindI18nStore)||""})})};exports.I18nextPlugin=()=>e=>(e.updateOptions({autoLoadRequiredData:!1}),e),exports.TOLGEE_PROCESSOR_NAME=n,exports.tolgeeApply=o,exports.tolgeeBackend=t,exports.tolgeeOptions=a,exports.tolgeeProcessor=r,exports.withTolgee=(e,n)=>{e.use(t(n)),e.use(r(n));const s=e.init;return e.init=(...t)=>{o(n,e);let r,l={};"object"==typeof t[0]?(l=t[0],r=t[1]):r=t[0];const i=a(0,l),c=s(i,r),u=e.language||l.lng;return u&&n.changeLanguage(u),n.run(),c},e},Object.keys(e).forEach((function(o){"default"===o||exports.hasOwnProperty(o)||Object.defineProperty(exports,o,{enumerable:!0,get:function(){return e[o]}})})); | ||
//# sourceMappingURL=tolgee-i18next.cjs.min.js.map |
@@ -7,3 +7,3 @@ export * from '@tolgee/web'; | ||
if (i18n.getResourceBundle(language, namespace)) { | ||
i18n.addResourceBundle(language, namespace, Object.fromEntries(data), false, true); | ||
i18n.addResourceBundle(language, namespace, data instanceof Map ? Object.fromEntries(data) : data, false, true); | ||
} | ||
@@ -32,3 +32,5 @@ }); | ||
}); | ||
callback(null, translations ? Object.fromEntries(translations) : undefined); | ||
callback(null, translations instanceof Map | ||
? Object.fromEntries(translations) | ||
: translations); | ||
} | ||
@@ -115,3 +117,3 @@ catch (e) { | ||
const I18nextPlugin = () => (tolgee) => { | ||
tolgee.updateOptions({ ns: [], defaultNs: undefined }); | ||
tolgee.updateOptions({ autoLoadRequiredData: false }); | ||
return tolgee; | ||
@@ -118,0 +120,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
export*from"@tolgee/web";const e=(e,o)=>{e.on("update",(()=>{e.getAllRecords().forEach((({language:e,namespace:n,data:t})=>{o.getResourceBundle(e,n)&&o.addResourceBundle(e,n,Object.fromEntries(t),!1,!0)}))})),o.on("languageChanged",(o=>{o&&e.getLanguage()!==o&&e.changeLanguage(o)})),o.tolgee=e},o=e=>({type:"backend",name:"TolgeeBackend",init(){},read:async function(o,n,t){try{const a=await e.loadRecord({language:o,namespace:n});t(null,a?Object.fromEntries(a):void 0)}catch(e){console.error(e),t(!0)}}}),n="tolgeeProcessor",t=e=>({type:"postProcessor",name:"tolgeeProcessor",process:function(o,n,t,a){var s,r,l,i,d,c;const u=null!==(l=null!==(s=t.keySeparator)&&void 0!==s?s:null===(r=null==a?void 0:a.options)||void 0===r?void 0:r.keySeparator)&&void 0!==l?l:".",{key:g,namespaces:p}=a.extractFromKey(n.join(u),t),v=null!==(d=null!==(i=null==p?void 0:p[0])&&void 0!==i?i:t.ns)&&void 0!==d?d:null===(c=null==a?void 0:a.options)||void 0===c?void 0:c.defaultNS;return e.wrap({key:g,defaultValue:t.defaultValue,translation:o,ns:v})}}),a=(e,o)=>{var t,a;let s;s="string"==typeof o.postProcess?[o.postProcess,n]:Array.isArray(o.postProcess)?[...o.postProcess,n]:[n];return Object.assign(Object.assign({},o),{postProcess:s,i18nFormat:Object.assign(Object.assign({},null==o?void 0:o.i18nFormat),{bindI18nStore:"added "+(null===(t=o.i18nFormat)||void 0===t?void 0:t.bindI18nStore)||""}),react:Object.assign(Object.assign({},null==o?void 0:o.react),{bindI18nStore:"added "+(null===(a=o.react)||void 0===a?void 0:a.bindI18nStore)||""})})},s=(n,s)=>{n.use(o(s)),n.use(t(s));const r=n.init;return n.init=(...o)=>{e(s,n);let t,l={};"object"==typeof o[0]?(l=o[0],t=o[1]):t=o[0];const i=a(0,l),d=r(i,t),c=n.language||l.lng;return c&&s.changeLanguage(c),s.run(),d},n},r=()=>e=>(e.updateOptions({ns:[],defaultNs:void 0}),e);export{r as I18nextPlugin,n as TOLGEE_PROCESSOR_NAME,e as tolgeeApply,o as tolgeeBackend,a as tolgeeOptions,t as tolgeeProcessor,s as withTolgee}; | ||
export*from"@tolgee/web";const e=(e,n)=>{e.on("update",(()=>{e.getAllRecords().forEach((({language:e,namespace:o,data:t})=>{n.getResourceBundle(e,o)&&n.addResourceBundle(e,o,t instanceof Map?Object.fromEntries(t):t,!1,!0)}))})),n.on("languageChanged",(n=>{n&&e.getLanguage()!==n&&e.changeLanguage(n)})),n.tolgee=e},n=e=>({type:"backend",name:"TolgeeBackend",init(){},read:async function(n,o,t){try{const a=await e.loadRecord({language:n,namespace:o});t(null,a instanceof Map?Object.fromEntries(a):a)}catch(e){console.error(e),t(!0)}}}),o="tolgeeProcessor",t=e=>({type:"postProcessor",name:"tolgeeProcessor",process:function(n,o,t,a){var r,s,l,i,c,d;const u=null!==(l=null!==(r=t.keySeparator)&&void 0!==r?r:null===(s=null==a?void 0:a.options)||void 0===s?void 0:s.keySeparator)&&void 0!==l?l:".",{key:g,namespaces:p}=a.extractFromKey(o.join(u),t),v=null!==(c=null!==(i=null==p?void 0:p[0])&&void 0!==i?i:t.ns)&&void 0!==c?c:null===(d=null==a?void 0:a.options)||void 0===d?void 0:d.defaultNS;return e.wrap({key:g,defaultValue:t.defaultValue,translation:n,ns:v})}}),a=(e,n)=>{var t,a;let r;r="string"==typeof n.postProcess?[n.postProcess,o]:Array.isArray(n.postProcess)?[...n.postProcess,o]:[o];return Object.assign(Object.assign({},n),{postProcess:r,i18nFormat:Object.assign(Object.assign({},null==n?void 0:n.i18nFormat),{bindI18nStore:"added "+(null===(t=n.i18nFormat)||void 0===t?void 0:t.bindI18nStore)||""}),react:Object.assign(Object.assign({},null==n?void 0:n.react),{bindI18nStore:"added "+(null===(a=n.react)||void 0===a?void 0:a.bindI18nStore)||""})})},r=(o,r)=>{o.use(n(r)),o.use(t(r));const s=o.init;return o.init=(...n)=>{e(r,o);let t,l={};"object"==typeof n[0]?(l=n[0],t=n[1]):t=n[0];const i=a(0,l),c=s(i,t),d=o.language||l.lng;return d&&r.changeLanguage(d),r.run(),c},o},s=()=>e=>(e.updateOptions({autoLoadRequiredData:!1}),e);export{s as I18nextPlugin,o as TOLGEE_PROCESSOR_NAME,e as tolgeeApply,n as tolgeeBackend,a as tolgeeOptions,t as tolgeeProcessor,r as withTolgee}; | ||
//# sourceMappingURL=tolgee-i18next.esm.min.js.map |
@@ -11,3 +11,3 @@ (function (global, factory) { | ||
if (i18n.getResourceBundle(language, namespace)) { | ||
i18n.addResourceBundle(language, namespace, Object.fromEntries(data), false, true); | ||
i18n.addResourceBundle(language, namespace, data instanceof Map ? Object.fromEntries(data) : data, false, true); | ||
} | ||
@@ -36,3 +36,5 @@ }); | ||
}); | ||
callback(null, translations ? Object.fromEntries(translations) : undefined); | ||
callback(null, translations instanceof Map | ||
? Object.fromEntries(translations) | ||
: translations); | ||
} | ||
@@ -119,3 +121,3 @@ catch (e) { | ||
const I18nextPlugin = () => (tolgee) => { | ||
tolgee.updateOptions({ ns: [], defaultNs: undefined }); | ||
tolgee.updateOptions({ autoLoadRequiredData: false }); | ||
return tolgee; | ||
@@ -122,0 +124,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("@tolgee/web")):"function"==typeof define&&define.amd?define(["exports","@tolgee/web"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/i18next"]={},e["@tolgee/web"])}(this,(function(e,o){"use strict";const n=(e,o)=>{e.on("update",(()=>{e.getAllRecords().forEach((({language:e,namespace:n,data:t})=>{o.getResourceBundle(e,n)&&o.addResourceBundle(e,n,Object.fromEntries(t),!1,!0)}))})),o.on("languageChanged",(o=>{o&&e.getLanguage()!==o&&e.changeLanguage(o)})),o.tolgee=e},t=e=>({type:"backend",name:"TolgeeBackend",init(){},read:async function(o,n,t){try{const a=await e.loadRecord({language:o,namespace:n});t(null,a?Object.fromEntries(a):void 0)}catch(e){console.error(e),t(!0)}}}),a="tolgeeProcessor",s=e=>({type:"postProcessor",name:"tolgeeProcessor",process:function(o,n,t,a){var s,r,l,i,d,c;const u=null!==(l=null!==(s=t.keySeparator)&&void 0!==s?s:null===(r=null==a?void 0:a.options)||void 0===r?void 0:r.keySeparator)&&void 0!==l?l:".",{key:g,namespaces:p}=a.extractFromKey(n.join(u),t),f=null!==(d=null!==(i=null==p?void 0:p[0])&&void 0!==i?i:t.ns)&&void 0!==d?d:null===(c=null==a?void 0:a.options)||void 0===c?void 0:c.defaultNS;return e.wrap({key:g,defaultValue:t.defaultValue,translation:o,ns:f})}}),r=(e,o)=>{var n,t;let s;s="string"==typeof o.postProcess?[o.postProcess,a]:Array.isArray(o.postProcess)?[...o.postProcess,a]:[a];return Object.assign(Object.assign({},o),{postProcess:s,i18nFormat:Object.assign(Object.assign({},null==o?void 0:o.i18nFormat),{bindI18nStore:"added "+(null===(n=o.i18nFormat)||void 0===n?void 0:n.bindI18nStore)||""}),react:Object.assign(Object.assign({},null==o?void 0:o.react),{bindI18nStore:"added "+(null===(t=o.react)||void 0===t?void 0:t.bindI18nStore)||""})})};e.I18nextPlugin=()=>e=>(e.updateOptions({ns:[],defaultNs:void 0}),e),e.TOLGEE_PROCESSOR_NAME=a,e.tolgeeApply=n,e.tolgeeBackend=t,e.tolgeeOptions=r,e.tolgeeProcessor=s,e.withTolgee=(e,o)=>{e.use(t(o)),e.use(s(o));const a=e.init;return e.init=(...t)=>{n(o,e);let s,l={};"object"==typeof t[0]?(l=t[0],s=t[1]):s=t[0];const i=r(0,l),d=a(i,s),c=e.language||l.lng;return c&&o.changeLanguage(c),o.run(),d},e},Object.keys(o).forEach((function(n){"default"===n||e.hasOwnProperty(n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return o[n]}})})),Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("@tolgee/web")):"function"==typeof define&&define.amd?define(["exports","@tolgee/web"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/i18next"]={},e["@tolgee/web"])}(this,(function(e,o){"use strict";const n=(e,o)=>{e.on("update",(()=>{e.getAllRecords().forEach((({language:e,namespace:n,data:t})=>{o.getResourceBundle(e,n)&&o.addResourceBundle(e,n,t instanceof Map?Object.fromEntries(t):t,!1,!0)}))})),o.on("languageChanged",(o=>{o&&e.getLanguage()!==o&&e.changeLanguage(o)})),o.tolgee=e},t=e=>({type:"backend",name:"TolgeeBackend",init(){},read:async function(o,n,t){try{const a=await e.loadRecord({language:o,namespace:n});t(null,a instanceof Map?Object.fromEntries(a):a)}catch(e){console.error(e),t(!0)}}}),a="tolgeeProcessor",r=e=>({type:"postProcessor",name:"tolgeeProcessor",process:function(o,n,t,a){var r,s,i,l,c,d;const u=null!==(i=null!==(r=t.keySeparator)&&void 0!==r?r:null===(s=null==a?void 0:a.options)||void 0===s?void 0:s.keySeparator)&&void 0!==i?i:".",{key:g,namespaces:p}=a.extractFromKey(n.join(u),t),f=null!==(c=null!==(l=null==p?void 0:p[0])&&void 0!==l?l:t.ns)&&void 0!==c?c:null===(d=null==a?void 0:a.options)||void 0===d?void 0:d.defaultNS;return e.wrap({key:g,defaultValue:t.defaultValue,translation:o,ns:f})}}),s=(e,o)=>{var n,t;let r;r="string"==typeof o.postProcess?[o.postProcess,a]:Array.isArray(o.postProcess)?[...o.postProcess,a]:[a];return Object.assign(Object.assign({},o),{postProcess:r,i18nFormat:Object.assign(Object.assign({},null==o?void 0:o.i18nFormat),{bindI18nStore:"added "+(null===(n=o.i18nFormat)||void 0===n?void 0:n.bindI18nStore)||""}),react:Object.assign(Object.assign({},null==o?void 0:o.react),{bindI18nStore:"added "+(null===(t=o.react)||void 0===t?void 0:t.bindI18nStore)||""})})};e.I18nextPlugin=()=>e=>(e.updateOptions({autoLoadRequiredData:!1}),e),e.TOLGEE_PROCESSOR_NAME=a,e.tolgeeApply=n,e.tolgeeBackend=t,e.tolgeeOptions=s,e.tolgeeProcessor=r,e.withTolgee=(e,o)=>{e.use(t(o)),e.use(r(o));const a=e.init;return e.init=(...t)=>{n(o,e);let r,i={};"object"==typeof t[0]?(i=t[0],r=t[1]):r=t[0];const l=s(0,i),c=a(l,r),d=e.language||i.lng;return d&&o.changeLanguage(d),o.run(),c},e},Object.keys(o).forEach((function(n){"default"===n||e.hasOwnProperty(n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return o[n]}})})),Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=tolgee-i18next.umd.min.js.map |
{ | ||
"name": "@tolgee/i18next", | ||
"version": "5.33.2", | ||
"version": "5.33.3-prerelease.2efc0e6b.0", | ||
"description": "Tolgee i18n integration.", | ||
@@ -47,3 +47,3 @@ "main": "./dist/tolgee-i18next.cjs.js", | ||
"@testing-library/jest-dom": "^5.11.4", | ||
"@tolgee/testing": "5.33.2", | ||
"@tolgee/testing": "5.33.3-prerelease.2efc0e6b.0", | ||
"@types/jest": "^28.1.6", | ||
@@ -66,3 +66,3 @@ "@types/node": "^18.6.1", | ||
}, | ||
"gitHead": "73467e06c29511cafab7e7162cef8ac4a36ff507", | ||
"gitHead": "799332abc27675f19c1b722ac063cbe2451f500e", | ||
"peerDependencies": { | ||
@@ -82,3 +82,3 @@ "i18next": "*" | ||
"dependencies": { | ||
"@tolgee/web": "5.33.2" | ||
"@tolgee/web": "5.33.3-prerelease.2efc0e6b.0" | ||
}, | ||
@@ -85,0 +85,0 @@ "publishConfig": { |
import { TolgeePlugin } from '@tolgee/web'; | ||
export const I18nextPlugin = (): TolgeePlugin => (tolgee) => { | ||
tolgee.updateOptions({ ns: [], defaultNs: undefined }); | ||
tolgee.updateOptions({ autoLoadRequiredData: false }); | ||
return tolgee; | ||
}; |
@@ -11,3 +11,3 @@ import { TolgeeInstance } from '@tolgee/web'; | ||
namespace, | ||
Object.fromEntries(data), | ||
data instanceof Map ? Object.fromEntries(data) : data, | ||
false, | ||
@@ -14,0 +14,0 @@ true |
@@ -17,3 +17,5 @@ import { TolgeeInstance } from '@tolgee/web'; | ||
null, | ||
translations ? Object.fromEntries(translations) : undefined | ||
translations instanceof Map | ||
? Object.fromEntries(translations) | ||
: translations | ||
); | ||
@@ -20,0 +22,0 @@ } catch (e) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
83298
863
3
+ Added@tolgee/core@5.33.3-prerelease.2efc0e6b.0(transitive)
+ Added@tolgee/web@5.33.3-prerelease.2efc0e6b.0(transitive)
- Removed@tolgee/core@5.33.2(transitive)
- Removed@tolgee/web@5.33.2(transitive)