@tolgee/i18next
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -33,2 +33,40 @@ 'use strict'; | ||
function __awaiter(thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
} | ||
function __generator(thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
} | ||
function __read(o, n) { | ||
@@ -63,5 +101,3 @@ var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
var updateTranslations = function () { | ||
tolgee.translationService | ||
.getCachedTranslations() | ||
.forEach(function (translations, lang) { | ||
tolgee.getCachedTranslations().forEach(function (translations, lang) { | ||
i18n.removeResourceBundle(lang, 'translation'); | ||
@@ -74,3 +110,3 @@ i18n.addResources(lang, 'translation', translations); | ||
if (lang && tolgee.lang !== lang) { | ||
tolgee.lang = lang; | ||
tolgee.changeLanguage(lang); | ||
} | ||
@@ -87,14 +123,21 @@ }); | ||
read: function (language, ns, callback) { | ||
if (language !== tolgee.lang) { | ||
tolgee.lang = language; | ||
} | ||
tolgee | ||
.translate('random') | ||
.then(function () { | ||
var translations = tolgee.translationService | ||
.getCachedTranslations() | ||
.get(language); | ||
callback(null, translations); | ||
}) | ||
.catch(function () { return callback(true); }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var translations; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_b.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, tolgee.loadTranslations(language)]; | ||
case 1: | ||
translations = _b.sent(); | ||
callback(null, translations); | ||
return [3 /*break*/, 3]; | ||
case 2: | ||
_b.sent(); | ||
callback(true); | ||
return [3 /*break*/, 3]; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}, | ||
@@ -101,0 +144,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@tolgee/core"),r=function(){return r=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var o in r=arguments[n])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},r.apply(this,arguments)}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@tolgee/core"),n=function(){return n=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},n.apply(this,arguments)}; | ||
/*! ***************************************************************************** | ||
@@ -15,3 +15,3 @@ Copyright (c) Microsoft Corporation. | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */function n(e,r,n){if(n||2===arguments.length)for(var t,o=0,a=r.length;o<a;o++)!t&&o in r||(t||(t=Array.prototype.slice.call(r,0,o)),t[o]=r[o]);return e.concat(t||Array.prototype.slice.call(r))}var t=function(e,r){e.onTranslationChange.subscribe((function(){e.translationService.getCachedTranslations().forEach((function(e,n){r.removeResourceBundle(n,"translation"),r.addResources(n,"translation",e)}))})),r.on("languageChanged",(function(r){r&&e.lang!==r&&(e.lang=r)})),r.tolgee=e},o=function(e){return{type:"backend",name:"TolgeeBackend",init:function(){},read:function(r,n,t){r!==e.lang&&(e.lang=r),e.translate("random").then((function(){var n=e.translationService.getCachedTranslations().get(r);t(null,n)})).catch((function(){return t(!0)}))}}},a=function(e,t){var o,a,i;return i="string"==typeof t.postProcess?[t.postProcess,"tolgeeProcessor"]:Array.isArray(t.postProcess)?n(n([],function(e,r){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var t,o,a=n.call(e),i=[];try{for(;(void 0===r||r-- >0)&&!(t=a.next()).done;)i.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}(t.postProcess),!1),["tolgeeProcessor"],!1):["tolgeeProcessor"],r(r({},t),{postProcess:i,i18nFormat:r(r({},null==t?void 0:t.i18nFormat),{bindI18nStore:"added "+(null===(o=t.i18nFormat)||void 0===o?void 0:o.bindI18nStore)||""}),react:r(r({},null==t?void 0:t.react),{bindI18nStore:"added "+(null===(a=t.react)||void 0===a?void 0:a.bindI18nStore)||""})})};exports.tolgeeApply=t,exports.tolgeeBackend=o,exports.tolgeeOptions=a,exports.withTolgee=function(n,i){var l=e.Tolgee.init(r({wrapperMode:"invisible"},i));n.use(o(l)),n.use(function(e){return{type:"postProcessor",name:"tolgeeProcessor",process:function(r,n,t){return e.wrap(n.join("."),void 0,t.defaultValue,r)}}}(l));var s=n.init;return n.init=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];t(l,n);var o={},i=void 0;"object"==typeof e[0]?(o=e[0],i=e[1]):i=e[0];var c=a(0,o),u=s(c,i),d=n.language||o.lng;return d&&(l.lang=d),l.run(),u},n}; | ||
***************************************************************************** */function r(e,n,r,t){return new(r||(r=Promise))((function(o,a){function i(e){try{c(t.next(e))}catch(e){a(e)}}function l(e){try{c(t.throw(e))}catch(e){a(e)}}function c(e){var n;e.done?o(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(i,l)}c((t=t.apply(e,n||[])).next())}))}function t(e,n){var r,t,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,t&&(o=2&a[0]?t.return:a[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,a[1])).done)return o;switch(t=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,t=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=n.call(e,i)}catch(e){a=[6,e],t=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function o(e,n,r){if(r||2===arguments.length)for(var t,o=0,a=n.length;o<a;o++)!t&&o in n||(t||(t=Array.prototype.slice.call(n,0,o)),t[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}var a=function(e,n){e.onTranslationChange.subscribe((function(){e.getCachedTranslations().forEach((function(e,r){n.removeResourceBundle(r,"translation"),n.addResources(r,"translation",e)}))})),n.on("languageChanged",(function(n){n&&e.lang!==n&&e.changeLanguage(n)})),n.tolgee=e},i=function(e){return{type:"backend",name:"TolgeeBackend",init:function(){},read:function(n,o,a){return r(this,void 0,void 0,(function(){var r;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,e.loadTranslations(n)];case 1:return r=t.sent(),a(null,r),[3,3];case 2:return t.sent(),a(!0),[3,3];case 3:return[2]}}))}))}}},l=function(e,r){var t,a,i;return i="string"==typeof r.postProcess?[r.postProcess,"tolgeeProcessor"]:Array.isArray(r.postProcess)?o(o([],function(e,n){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var t,o,a=r.call(e),i=[];try{for(;(void 0===n||n-- >0)&&!(t=a.next()).done;)i.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}(r.postProcess),!1),["tolgeeProcessor"],!1):["tolgeeProcessor"],n(n({},r),{postProcess:i,i18nFormat:n(n({},null==r?void 0:r.i18nFormat),{bindI18nStore:"added "+(null===(t=r.i18nFormat)||void 0===t?void 0:t.bindI18nStore)||""}),react:n(n({},null==r?void 0:r.react),{bindI18nStore:"added "+(null===(a=r.react)||void 0===a?void 0:a.bindI18nStore)||""})})};exports.tolgeeApply=a,exports.tolgeeBackend=i,exports.tolgeeOptions=l,exports.withTolgee=function(r,t){var o=e.Tolgee.init(n({wrapperMode:"invisible"},t));r.use(i(o)),r.use(function(e){return{type:"postProcessor",name:"tolgeeProcessor",process:function(n,r,t){return e.wrap(r.join("."),void 0,t.defaultValue,n)}}}(o));var c=r.init;return r.init=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a(o,r);var t={},i=void 0;"object"==typeof e[0]?(t=e[0],i=e[1]):i=e[0];var u=l(0,t),s=c(u,i),f=r.language||t.lng;return f&&(o.lang=f),o.run(),s},r}; | ||
//# sourceMappingURL=tolgee-i18next.cjs.min.js.map |
@@ -15,3 +15,3 @@ import{Tolgee as n}from"@tolgee/core"; | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var r=function(){return r=Object.assign||function(n){for(var r,e=1,o=arguments.length;e<o;e++)for(var t in r=arguments[e])Object.prototype.hasOwnProperty.call(r,t)&&(n[t]=r[t]);return n},r.apply(this,arguments)};function e(n,r,e){if(e||2===arguments.length)for(var o,t=0,a=r.length;t<a;t++)!o&&t in r||(o||(o=Array.prototype.slice.call(r,0,t)),o[t]=r[t]);return n.concat(o||Array.prototype.slice.call(r))}var o=function(n,r){n.onTranslationChange.subscribe((function(){n.translationService.getCachedTranslations().forEach((function(n,e){r.removeResourceBundle(e,"translation"),r.addResources(e,"translation",n)}))})),r.on("languageChanged",(function(r){r&&n.lang!==r&&(n.lang=r)})),r.tolgee=n},t=function(n){return{type:"backend",name:"TolgeeBackend",init:function(){},read:function(r,e,o){r!==n.lang&&(n.lang=r),n.translate("random").then((function(){var e=n.translationService.getCachedTranslations().get(r);o(null,e)})).catch((function(){return o(!0)}))}}},a=function(n,o){var t,a,i;return i="string"==typeof o.postProcess?[o.postProcess,"tolgeeProcessor"]:Array.isArray(o.postProcess)?e(e([],function(n,r){var e="function"==typeof Symbol&&n[Symbol.iterator];if(!e)return n;var o,t,a=e.call(n),i=[];try{for(;(void 0===r||r-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(n){t={error:n}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}return i}(o.postProcess),!1),["tolgeeProcessor"],!1):["tolgeeProcessor"],r(r({},o),{postProcess:i,i18nFormat:r(r({},null==o?void 0:o.i18nFormat),{bindI18nStore:"added "+(null===(t=o.i18nFormat)||void 0===t?void 0:t.bindI18nStore)||""}),react:r(r({},null==o?void 0:o.react),{bindI18nStore:"added "+(null===(a=o.react)||void 0===a?void 0:a.bindI18nStore)||""})})},i=function(e,i){var l=n.init(r({wrapperMode:"invisible"},i));e.use(t(l)),e.use(function(n){return{type:"postProcessor",name:"tolgeeProcessor",process:function(r,e,o){return n.wrap(e.join("."),void 0,o.defaultValue,r)}}}(l));var c=e.init;return e.init=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];o(l,e);var t={},i=void 0;"object"==typeof n[0]?(t=n[0],i=n[1]):i=n[0];var s=a(0,t),u=c(s,i),f=e.language||t.lng;return f&&(l.lang=f),l.run(),u},e};export{o as tolgeeApply,t as tolgeeBackend,a as tolgeeOptions,i as withTolgee}; | ||
***************************************************************************** */var r=function(){return r=Object.assign||function(n){for(var r,e=1,t=arguments.length;e<t;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o]);return n},r.apply(this,arguments)};function e(n,r,e,t){return new(e||(e=Promise))((function(o,a){function i(n){try{l(t.next(n))}catch(n){a(n)}}function c(n){try{l(t.throw(n))}catch(n){a(n)}}function l(n){var r;n.done?o(n.value):(r=n.value,r instanceof e?r:new e((function(n){n(r)}))).then(i,c)}l((t=t.apply(n,r||[])).next())}))}function t(n,r){var e,t,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(e)throw new TypeError("Generator is already executing.");for(;i;)try{if(e=1,t&&(o=2&a[0]?t.return:a[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,a[1])).done)return o;switch(t=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,t=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=r.call(n,i)}catch(n){a=[6,n],t=0}finally{e=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function o(n,r,e){if(e||2===arguments.length)for(var t,o=0,a=r.length;o<a;o++)!t&&o in r||(t||(t=Array.prototype.slice.call(r,0,o)),t[o]=r[o]);return n.concat(t||Array.prototype.slice.call(r))}var a=function(n,r){n.onTranslationChange.subscribe((function(){n.getCachedTranslations().forEach((function(n,e){r.removeResourceBundle(e,"translation"),r.addResources(e,"translation",n)}))})),r.on("languageChanged",(function(r){r&&n.lang!==r&&n.changeLanguage(r)})),r.tolgee=n},i=function(n){return{type:"backend",name:"TolgeeBackend",init:function(){},read:function(r,o,a){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,n.loadTranslations(r)];case 1:return e=t.sent(),a(null,e),[3,3];case 2:return t.sent(),a(!0),[3,3];case 3:return[2]}}))}))}}},c=function(n,e){var t,a,i;return i="string"==typeof e.postProcess?[e.postProcess,"tolgeeProcessor"]:Array.isArray(e.postProcess)?o(o([],function(n,r){var e="function"==typeof Symbol&&n[Symbol.iterator];if(!e)return n;var t,o,a=e.call(n),i=[];try{for(;(void 0===r||r-- >0)&&!(t=a.next()).done;)i.push(t.value)}catch(n){o={error:n}}finally{try{t&&!t.done&&(e=a.return)&&e.call(a)}finally{if(o)throw o.error}}return i}(e.postProcess),!1),["tolgeeProcessor"],!1):["tolgeeProcessor"],r(r({},e),{postProcess:i,i18nFormat:r(r({},null==e?void 0:e.i18nFormat),{bindI18nStore:"added "+(null===(t=e.i18nFormat)||void 0===t?void 0:t.bindI18nStore)||""}),react:r(r({},null==e?void 0:e.react),{bindI18nStore:"added "+(null===(a=e.react)||void 0===a?void 0:a.bindI18nStore)||""})})},l=function(e,t){var o=n.init(r({wrapperMode:"invisible"},t));e.use(i(o)),e.use(function(n){return{type:"postProcessor",name:"tolgeeProcessor",process:function(r,e,t){return n.wrap(e.join("."),void 0,t.defaultValue,r)}}}(o));var l=e.init;return e.init=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];a(o,e);var t={},i=void 0;"object"==typeof n[0]?(t=n[0],i=n[1]):i=n[0];var u=c(0,t),s=l(u,i),f=e.language||t.lng;return f&&(o.lang=f),o.run(),s},e};export{a as tolgeeApply,i as tolgeeBackend,c as tolgeeOptions,l as withTolgee}; | ||
//# sourceMappingURL=tolgee-i18next.esm.js.map |
@@ -33,2 +33,40 @@ (function (global, factory) { | ||
function __awaiter(thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
} | ||
function __generator(thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
} | ||
function __read(o, n) { | ||
@@ -63,5 +101,3 @@ var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
var updateTranslations = function () { | ||
tolgee.translationService | ||
.getCachedTranslations() | ||
.forEach(function (translations, lang) { | ||
tolgee.getCachedTranslations().forEach(function (translations, lang) { | ||
i18n.removeResourceBundle(lang, 'translation'); | ||
@@ -74,3 +110,3 @@ i18n.addResources(lang, 'translation', translations); | ||
if (lang && tolgee.lang !== lang) { | ||
tolgee.lang = lang; | ||
tolgee.changeLanguage(lang); | ||
} | ||
@@ -87,14 +123,21 @@ }); | ||
read: function (language, ns, callback) { | ||
if (language !== tolgee.lang) { | ||
tolgee.lang = language; | ||
} | ||
tolgee | ||
.translate('random') | ||
.then(function () { | ||
var translations = tolgee.translationService | ||
.getCachedTranslations() | ||
.get(language); | ||
callback(null, translations); | ||
}) | ||
.catch(function () { return callback(true); }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var translations; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_b.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, tolgee.loadTranslations(language)]; | ||
case 1: | ||
translations = _b.sent(); | ||
callback(null, translations); | ||
return [3 /*break*/, 3]; | ||
case 2: | ||
_b.sent(); | ||
callback(true); | ||
return [3 /*break*/, 3]; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}, | ||
@@ -101,0 +144,0 @@ }; |
@@ -15,3 +15,3 @@ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@tolgee/core")):"function"==typeof define&&define.amd?define(["exports","@tolgee/core"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/i18next"]={},e["@tolgee/core"])}(this,(function(e,n){"use strict"; | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var t=function(){return t=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},t.apply(this,arguments)};function o(e,n,t){if(t||2===arguments.length)for(var o,r=0,i=n.length;r<i;r++)!o&&r in n||(o||(o=Array.prototype.slice.call(n,0,r)),o[r]=n[r]);return e.concat(o||Array.prototype.slice.call(n))}var r=function(e,n){e.onTranslationChange.subscribe((function(){e.translationService.getCachedTranslations().forEach((function(e,t){n.removeResourceBundle(t,"translation"),n.addResources(t,"translation",e)}))})),n.on("languageChanged",(function(n){n&&e.lang!==n&&(e.lang=n)})),n.tolgee=e},i=function(e){return{type:"backend",name:"TolgeeBackend",init:function(){},read:function(n,t,o){n!==e.lang&&(e.lang=n),e.translate("random").then((function(){var t=e.translationService.getCachedTranslations().get(n);o(null,t)})).catch((function(){return o(!0)}))}}},a="tolgeeProcessor",l=function(e,n){var r,i,l;return l="string"==typeof n.postProcess?[n.postProcess,a]:Array.isArray(n.postProcess)?o(o([],function(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var o,r,i=t.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(r)throw r.error}}return a}(n.postProcess),!1),[a],!1):[a],t(t({},n),{postProcess:l,i18nFormat:t(t({},null==n?void 0:n.i18nFormat),{bindI18nStore:"added "+(null===(r=n.i18nFormat)||void 0===r?void 0:r.bindI18nStore)||""}),react:t(t({},null==n?void 0:n.react),{bindI18nStore:"added "+(null===(i=n.react)||void 0===i?void 0:i.bindI18nStore)||""})})};e.tolgeeApply=r,e.tolgeeBackend=i,e.tolgeeOptions=l,e.withTolgee=function(e,o){var a=n.Tolgee.init(t({wrapperMode:"invisible"},o));e.use(i(a)),e.use(function(e){return{type:"postProcessor",name:"tolgeeProcessor",process:function(n,t,o){return e.wrap(t.join("."),void 0,o.defaultValue,n)}}}(a));var c=e.init;return e.init=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];r(a,e);var o={},i=void 0;"object"==typeof n[0]?(o=n[0],i=n[1]):i=n[0];var s=l(0,o),u=c(s,i),f=e.language||o.lng;return f&&(a.lang=f),a.run(),u},e},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
***************************************************************************** */var t=function(){return t=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},t.apply(this,arguments)};function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,l)}u((r=r.apply(e,n||[])).next())}))}function o(e,n){var t,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=n.call(e,a)}catch(e){i=[6,e],r=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function i(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}var a=function(e,n){e.onTranslationChange.subscribe((function(){e.getCachedTranslations().forEach((function(e,t){n.removeResourceBundle(t,"translation"),n.addResources(t,"translation",e)}))})),n.on("languageChanged",(function(n){n&&e.lang!==n&&e.changeLanguage(n)})),n.tolgee=e},l=function(e){return{type:"backend",name:"TolgeeBackend",init:function(){},read:function(n,t,i){return r(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,e.loadTranslations(n)];case 1:return t=r.sent(),i(null,t),[3,3];case 2:return r.sent(),i(!0),[3,3];case 3:return[2]}}))}))}}},u="tolgeeProcessor",c=function(e,n){var r,o,a;return a="string"==typeof n.postProcess?[n.postProcess,u]:Array.isArray(n.postProcess)?i(i([],function(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}(n.postProcess),!1),[u],!1):[u],t(t({},n),{postProcess:a,i18nFormat:t(t({},null==n?void 0:n.i18nFormat),{bindI18nStore:"added "+(null===(r=n.i18nFormat)||void 0===r?void 0:r.bindI18nStore)||""}),react:t(t({},null==n?void 0:n.react),{bindI18nStore:"added "+(null===(o=n.react)||void 0===o?void 0:o.bindI18nStore)||""})})};e.tolgeeApply=a,e.tolgeeBackend=l,e.tolgeeOptions=c,e.withTolgee=function(e,r){var o=n.Tolgee.init(t({wrapperMode:"invisible"},r));e.use(l(o)),e.use(function(e){return{type:"postProcessor",name:"tolgeeProcessor",process:function(n,t,r){return e.wrap(t.join("."),void 0,r.defaultValue,n)}}}(o));var i=e.init;return e.init=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];a(o,e);var r={},l=void 0;"object"==typeof n[0]?(r=n[0],l=n[1]):l=n[0];var u=c(0,r),s=i(u,l),f=e.language||r.lng;return f&&(o.lang=f),o.run(),s},e},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=tolgee-i18next.umd.min.js.map |
{ | ||
"name": "@tolgee/i18next", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "Tolgee i18n integration.", | ||
@@ -60,3 +60,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "8b6f4e4ac2013d4b85cd2193f2f101c27bff9fd6", | ||
"gitHead": "1847abd7f22db76b969a5e6da9fdc5a7ed11dabf", | ||
"publishConfig": { | ||
@@ -69,4 +69,4 @@ "access": "public" | ||
"dependencies": { | ||
"@tolgee/core": "^3.1.1" | ||
"@tolgee/core": "^3.1.2" | ||
} | ||
} |
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
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
168119
592
Updated@tolgee/core@^3.1.2