@tolgee/i18next
Advanced tools
Comparing version 5.0.0-alpha.1 to 5.0.0-rc.8558283.0
@@ -218,3 +218,2 @@ 'use strict'; | ||
var I18nextPlugin = function () { return function (tolgee) { | ||
tolgee.addPlugin(web.DevTools()); | ||
tolgee.updateOptions({ ns: [] }); | ||
@@ -221,0 +220,0 @@ return tolgee; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@tolgee/web"),n=function(e,n){e.on("initialLoad",(function(){e.getAllRecords().forEach((function(e){var t=e.language,r=e.namespace,o=e.data,a=r||"translation";n.removeResourceBundle(t,a),n.addResources(t,a,Object.fromEntries(o))}))})),n.on("languageChanged",(function(n){n&&e.getLanguage()!==n&&e.changeLanguage(n)})),n.tolgee=e},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,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function u(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,u)}c((r=r.apply(e,n||[])).next())}))}function o(e,n){var t,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;i;)try{if(t=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=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++,r=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],r=0}finally{t=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function a(e,n,t){if(t||2===arguments.length)for(var r,o=0,a=n.length;o<a;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 i=function(e){return{type:"backend",name:"TolgeeBackend",init:function(){},read:function(n,t,a){return r(this,void 0,void 0,(function(){var r,i;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,e.loadRecord({language:n,namespace:"translation"===t?"":void 0})];case 1:return r=o.sent(),a(null,Object.fromEntries(r)),[3,3];case 2:return i=o.sent(),console.error(i),a(!0),[3,3];case 3:return[2]}}))}))}}},u=function(e){return{type:"postProcessor",name:"tolgeeProcessor",process:function(n,t,r){return e.wrap({key:t.join("."),defaultValue:r.defaultValue,translation:n})}}},c=function(e,n){var r,o,i;return i="string"==typeof n.postProcess?[n.postProcess,"tolgeeProcessor"]:Array.isArray(n.postProcess)?a(a([],function(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,a=t.call(e),i=[];try{for(;(void 0===n||n-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=a.return)&&t.call(a)}finally{if(o)throw o.error}}return i}(n.postProcess),!1),["tolgeeProcessor"],!1):["tolgeeProcessor"],t(t({},n),{postProcess:i,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)||""})})};exports.I18nextPlugin=function(){return function(n){return n.addPlugin(e.DevTools()),n.updateOptions({ns:[]}),n}},exports.TOLGEE_PROCESSOR_NAME="tolgeeProcessor",exports.tolgeeApply=n,exports.tolgeeBackend=i,exports.tolgeeOptions=c,exports.tolgeeProcessor=u,exports.withTolgee=function(e,t){e.use(i(t)),e.use(u(t));var r=e.init;return e.init=function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];n(t,e);var i={},u=void 0;"object"==typeof o[0]?(i=o[0],u=o[1]):u=o[0];var l=c(0,i),s=r(l,u),f=e.language||i.lng;return f&&t.changeLanguage(f),t.run(),s},e},Object.keys(e).forEach((function(n){"default"===n||exports.hasOwnProperty(n)||Object.defineProperty(exports,n,{enumerable:!0,get:function(){return e[n]}})})); | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@tolgee/web"),t=function(e,t){e.on("initialLoad",(function(){e.getAllRecords().forEach((function(e){var n=e.language,r=e.namespace,o=e.data,a=r||"translation";t.removeResourceBundle(n,a),t.addResources(n,a,Object.fromEntries(o))}))})),t.on("languageChanged",(function(t){t&&e.getLanguage()!==t&&e.changeLanguage(t)})),t.tolgee=e},n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};function r(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function u(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,u)}c((r=r.apply(e,t||[])).next())}))}function o(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=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++,r=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=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function a(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var i=function(e){return{type:"backend",name:"TolgeeBackend",init:function(){},read:function(t,n,a){return r(this,void 0,void 0,(function(){var r,i;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,e.loadRecord({language:t,namespace:"translation"===n?"":void 0})];case 1:return r=o.sent(),a(null,Object.fromEntries(r)),[3,3];case 2:return i=o.sent(),console.error(i),a(!0),[3,3];case 3:return[2]}}))}))}}},u=function(e){return{type:"postProcessor",name:"tolgeeProcessor",process:function(t,n,r){return e.wrap({key:n.join("."),defaultValue:r.defaultValue,translation:t})}}},c=function(e,t){var r,o,i;return i="string"==typeof t.postProcess?[t.postProcess,"tolgeeProcessor"]:Array.isArray(t.postProcess)?a(a([],function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}(t.postProcess),!1),["tolgeeProcessor"],!1):["tolgeeProcessor"],n(n({},t),{postProcess:i,i18nFormat:n(n({},null==t?void 0:t.i18nFormat),{bindI18nStore:"added "+(null===(r=t.i18nFormat)||void 0===r?void 0:r.bindI18nStore)||""}),react:n(n({},null==t?void 0:t.react),{bindI18nStore:"added "+(null===(o=t.react)||void 0===o?void 0:o.bindI18nStore)||""})})};exports.I18nextPlugin=function(){return function(e){return e.updateOptions({ns:[]}),e}},exports.TOLGEE_PROCESSOR_NAME="tolgeeProcessor",exports.tolgeeApply=t,exports.tolgeeBackend=i,exports.tolgeeOptions=c,exports.tolgeeProcessor=u,exports.withTolgee=function(e,n){e.use(i(n)),e.use(u(n));var r=e.init;return e.init=function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];t(n,e);var i={},u=void 0;"object"==typeof o[0]?(i=o[0],u=o[1]):u=o[0];var l=c(0,i),s=r(l,u),f=e.language||i.lng;return f&&n.changeLanguage(f),n.run(),s},e},Object.keys(e).forEach((function(t){"default"===t||exports.hasOwnProperty(t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})})); | ||
//# sourceMappingURL=tolgee-i18next.cjs.min.js.map |
@@ -1,2 +0,1 @@ | ||
import { DevTools } from '@tolgee/web'; | ||
export * from '@tolgee/web'; | ||
@@ -215,3 +214,2 @@ | ||
var I18nextPlugin = function () { return function (tolgee) { | ||
tolgee.addPlugin(DevTools()); | ||
tolgee.updateOptions({ ns: [] }); | ||
@@ -218,0 +216,0 @@ return tolgee; |
@@ -218,3 +218,2 @@ (function (global, factory) { | ||
var I18nextPlugin = function () { return function (tolgee) { | ||
tolgee.addPlugin(web.DevTools()); | ||
tolgee.updateOptions({ ns: [] }); | ||
@@ -221,0 +220,0 @@ return tolgee; |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@tolgee/web")):"function"==typeof define&&define.amd?define(["exports","@tolgee/web"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/i18next"]={},e["@tolgee/web"])}(this,(function(e,n){"use strict";var t=function(e,n){e.on("initialLoad",(function(){e.getAllRecords().forEach((function(e){var t=e.language,r=e.namespace,o=e.data,a=r||"translation";n.removeResourceBundle(t,a),n.addResources(t,a,Object.fromEntries(o))}))})),n.on("languageChanged",(function(n){n&&e.getLanguage()!==n&&e.changeLanguage(n)})),n.tolgee=e},r=function(){return r=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},r.apply(this,arguments)};function o(e,n,t,r){return new(t||(t=Promise))((function(o,a){function i(e){try{l(r.next(e))}catch(e){a(e)}}function u(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,u)}l((r=r.apply(e,n||[])).next())}))}function a(e,n){var t,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;i;)try{if(t=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=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++,r=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],r=0}finally{t=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function i(e,n,t){if(t||2===arguments.length)for(var r,o=0,a=n.length;o<a;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 u=function(e){return{type:"backend",name:"TolgeeBackend",init:function(){},read:function(n,t,r){return o(this,void 0,void 0,(function(){var o,i;return a(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,e.loadRecord({language:n,namespace:"translation"===t?"":void 0})];case 1:return o=a.sent(),r(null,Object.fromEntries(o)),[3,3];case 2:return i=a.sent(),console.error(i),r(!0),[3,3];case 3:return[2]}}))}))}}},l="tolgeeProcessor",c=function(e){return{type:"postProcessor",name:"tolgeeProcessor",process:function(n,t,r){return e.wrap({key:t.join("."),defaultValue:r.defaultValue,translation:n})}}},s=function(e,n){var t,o,a;return a="string"==typeof n.postProcess?[n.postProcess,l]:Array.isArray(n.postProcess)?i(i([],function(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,a=t.call(e),i=[];try{for(;(void 0===n||n-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=a.return)&&t.call(a)}finally{if(o)throw o.error}}return i}(n.postProcess),!1),[l],!1):[l],r(r({},n),{postProcess:a,i18nFormat:r(r({},null==n?void 0:n.i18nFormat),{bindI18nStore:"added "+(null===(t=n.i18nFormat)||void 0===t?void 0:t.bindI18nStore)||""}),react:r(r({},null==n?void 0:n.react),{bindI18nStore:"added "+(null===(o=n.react)||void 0===o?void 0:o.bindI18nStore)||""})})};e.I18nextPlugin=function(){return function(e){return e.addPlugin(n.DevTools()),e.updateOptions({ns:[]}),e}},e.TOLGEE_PROCESSOR_NAME=l,e.tolgeeApply=t,e.tolgeeBackend=u,e.tolgeeOptions=s,e.tolgeeProcessor=c,e.withTolgee=function(e,n){e.use(u(n)),e.use(c(n));var r=e.init;return e.init=function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];t(n,e);var i={},u=void 0;"object"==typeof o[0]?(i=o[0],u=o[1]):u=o[0];var l=s(0,i),c=r(l,u),f=e.language||i.lng;return f&&n.changeLanguage(f),n.run(),c},e},Object.keys(n).forEach((function(t){"default"===t||e.hasOwnProperty(t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})),Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@tolgee/web")):"function"==typeof define&&define.amd?define(["exports","@tolgee/web"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["@tolgee/i18next"]={},e["@tolgee/web"])}(this,(function(e,n){"use strict";var t=function(e,n){e.on("initialLoad",(function(){e.getAllRecords().forEach((function(e){var t=e.language,r=e.namespace,o=e.data,a=r||"translation";n.removeResourceBundle(t,a),n.addResources(t,a,Object.fromEntries(o))}))})),n.on("languageChanged",(function(n){n&&e.getLanguage()!==n&&e.changeLanguage(n)})),n.tolgee=e},r=function(){return r=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},r.apply(this,arguments)};function o(e,n,t,r){return new(t||(t=Promise))((function(o,a){function i(e){try{l(r.next(e))}catch(e){a(e)}}function u(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,u)}l((r=r.apply(e,n||[])).next())}))}function a(e,n){var t,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;i;)try{if(t=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=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++,r=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],r=0}finally{t=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function i(e,n,t){if(t||2===arguments.length)for(var r,o=0,a=n.length;o<a;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 u=function(e){return{type:"backend",name:"TolgeeBackend",init:function(){},read:function(n,t,r){return o(this,void 0,void 0,(function(){var o,i;return a(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,e.loadRecord({language:n,namespace:"translation"===t?"":void 0})];case 1:return o=a.sent(),r(null,Object.fromEntries(o)),[3,3];case 2:return i=a.sent(),console.error(i),r(!0),[3,3];case 3:return[2]}}))}))}}},l="tolgeeProcessor",c=function(e){return{type:"postProcessor",name:"tolgeeProcessor",process:function(n,t,r){return e.wrap({key:t.join("."),defaultValue:r.defaultValue,translation:n})}}},s=function(e,n){var t,o,a;return a="string"==typeof n.postProcess?[n.postProcess,l]:Array.isArray(n.postProcess)?i(i([],function(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,a=t.call(e),i=[];try{for(;(void 0===n||n-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=a.return)&&t.call(a)}finally{if(o)throw o.error}}return i}(n.postProcess),!1),[l],!1):[l],r(r({},n),{postProcess:a,i18nFormat:r(r({},null==n?void 0:n.i18nFormat),{bindI18nStore:"added "+(null===(t=n.i18nFormat)||void 0===t?void 0:t.bindI18nStore)||""}),react:r(r({},null==n?void 0:n.react),{bindI18nStore:"added "+(null===(o=n.react)||void 0===o?void 0:o.bindI18nStore)||""})})};e.I18nextPlugin=function(){return function(e){return e.updateOptions({ns:[]}),e}},e.TOLGEE_PROCESSOR_NAME=l,e.tolgeeApply=t,e.tolgeeBackend=u,e.tolgeeOptions=s,e.tolgeeProcessor=c,e.withTolgee=function(e,n){e.use(u(n)),e.use(c(n));var r=e.init;return e.init=function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];t(n,e);var i={},u=void 0;"object"==typeof o[0]?(i=o[0],u=o[1]):u=o[0];var l=s(0,i),c=r(l,u),f=e.language||i.lng;return f&&n.changeLanguage(f),n.run(),c},e},Object.keys(n).forEach((function(t){"default"===t||e.hasOwnProperty(t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})),Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=tolgee-i18next.umd.min.js.map |
{ | ||
"name": "@tolgee/i18next", | ||
"version": "5.0.0-alpha.1", | ||
"version": "5.0.0-rc.8558283.0", | ||
"description": "Tolgee i18n integration.", | ||
@@ -45,3 +45,3 @@ "main": "./dist/tolgee-i18next.cjs.js", | ||
"@testing-library/jest-dom": "^5.11.4", | ||
"@tolgee/testing": "5.0.0-alpha.1", | ||
"@tolgee/testing": "5.0.0-rc.8558283.0", | ||
"@types/jest": "^28.1.6", | ||
@@ -63,3 +63,3 @@ "@types/node": "^18.6.1", | ||
}, | ||
"gitHead": "9c66dbc9a72cc2874cf24abbe99af5eb6df45d50", | ||
"gitHead": "25bd3e76e73b5a83fb01a2341e98f5fd7ff1fd46", | ||
"peerDependencies": { | ||
@@ -73,3 +73,3 @@ "i18next": "^21.5.4" | ||
"dependencies": { | ||
"@tolgee/web": "5.0.0-alpha.1" | ||
"@tolgee/web": "5.0.0-rc.8558283.0" | ||
}, | ||
@@ -76,0 +76,0 @@ "publishConfig": { |
154
README.md
@@ -1,50 +0,88 @@ | ||
# Tolgee i18next integration | ||
<!-- This file was generated using pnpm generate-readmes script | ||
Don't edit this file. Edit the README.md.njk. Macros can be found in readmeMacros/macros.njk | ||
--> | ||
<h1 align="center" style="border-bottom: none"> | ||
<b> | ||
<a href="https://tolgee.io">Tolgee i18next integration</a><br> | ||
</b> | ||
A package enabling you to use i18next with Tolgee | ||
<br> | ||
</h1> | ||
<div align="center"> | ||
[![Logo](https://user-images.githubusercontent.com/18496315/188628892-33fcc282-26f1-4035-8105-95952bd93de9.svg)](https://tolgee.io) | ||
Tolgee is an open-source alternative to Crowdin, Phrase, or Lokalise with its very own revolutionary integrations. | ||
![test workflow](https://github.com/tolgee/tolgee-js/actions/workflows/test.yml/badge.svg) | ||
![@tolgee/i18next version](https://img.shields.io/npm/v/@tolgee/i18next?label=%40tolgee%2Fi18next) | ||
![@tolgee/i18next version](https://img.shields.io/npm/v/@tolgee/i18next?label=@tolgee/i18next) | ||
![types typescript](https://img.shields.io/badge/Types-Typescript-blue) | ||
[![twitter](https://img.shields.io/twitter/follow/Tolgee_i18n?style=social)](https://twitter.com/Tolgee_i18n) | ||
[![github stars](https://img.shields.io/github/stars/tolgee/tolgee-js?style=social)](https://github.com/tolgee/tolgee-js) | ||
![typescript](https://img.shields.io/github/languages/top/tolgee/tolgee-js) | ||
![licence](https://img.shields.io/github/license/tolgee/tolgee-js) | ||
[![github stars](https://img.shields.io/github/stars/tolgee/tolgee-js?style=social&label=Tolgee%20JS)](https://github.com/tolgee/tolgee-js) | ||
[![github stars](https://img.shields.io/github/stars/tolgee/server?style=social&label=Tolgee%20Server)](https://github.com/tolgee/server) | ||
[![Github discussions](https://img.shields.io/github/discussions/tolgee/tolgee-platform)](https://github.com/tolgee/tolgee-platform/discussions) | ||
</div> | ||
[<img src="https://raw.githubusercontent.com/tolgee/documentation/main/tolgee_logo_text.svg" alt="Tolgee" width="200" />](https://tolgee.io) | ||
<div align="center"> | ||
Tolgee i18next integration. For more information about Tolgee Toolkit, visit our documentation website | ||
[tolgee.io](https://tolgee.io). | ||
[<img src="https://img.shields.io/badge/-Facebook-424549?style=social&logo=facebook" height=25 />](https://www.facebook.com/Tolgee.i18n) | ||
[<img src="https://img.shields.io/badge/-Twitter-424549?style=social&logo=twitter" height=25 />](https://twitter.com/Tolgee_i18n) | ||
[<img src="https://img.shields.io/badge/-Linkedin-424549?style=social&logo=linkedin" height=25 />](https://www.linkedin.com/company/tolgee) | ||
## Installation | ||
**Become part of the family. Join [slack channel <img src="https://img.shields.io/badge/-Tolgee Comunity-424549?style=social&logo=slack" height=25 />](https://join.slack.com/t/tolgeecommunity/shared_invite/zt-195isb5u8-_RcSRgVJfvgsPpOBIok~IQ)** | ||
``` | ||
npm install i18next @tolgee/i18next | ||
``` | ||
</div> | ||
## Usage | ||
First, create a Tolgee instance and initialize it. | ||
```ts | ||
import i18next from 'i18next'; | ||
import { withTolgee } from "@tolgee/i18next"; | ||
## What's the Tolgee i18next package? | ||
Using i18next, but want to use cool Tolgee features like in-context editing or automated screenshot generation? | ||
No worries. Tolgee i18next integration is here for you! | ||
withTolgee(i18n, { ... tolgee config ... }) | ||
.init({ ... i18next config ... }) | ||
``` | ||
This will: | ||
## Quick links | ||
- [Tolgee i18next docs](https://tolgee.io/js-sdk/5.0.0-alpha.1/integrations/i18next/installation) | ||
- [Tolgee JS SDK docs](https://tolgee.io/js-sdk) | ||
- [Tolgee Website](https://tolgee.io) | ||
- Product (Learn more about the great features) | ||
- [Dev tools](https://tolgee.io/features/dev-tools) | ||
- [Translation assistance](https://tolgee.io/features/translation-assistance) | ||
- [Collaboration](https://tolgee.io/features/collaboration) | ||
- [Tolgee platform docs](https://tolgee.io/platform) | ||
- use add `tolgeeBackend` as backend plugin | ||
- use `tolgeeProcessor` for wrapping translations (with invivisible wrapperMode) | ||
- will call `tolgeeApply` on i18n instance to apply listeners and register tolgee (`i18n.tolgee`) | ||
- will wrap `.init` function with custom function, which will use `tolgeeOptions` to merge config with our custom config that is needed for in-context to work | ||
We also recommend using `ICU message format`, which is supported by Tolgee platform. | ||
## Installation | ||
``` | ||
npm install i18next-icu | ||
npm install @tolgee/i18next | ||
``` | ||
## Usage | ||
First, create a Tolgee instance and wrap your i18next instance withTolgee. | ||
```ts | ||
import ICU from 'i18next-icu'; | ||
import i18n from 'i18next'; | ||
import { withTolgee, Tolgee, I18nextPlugin, FormatSimple } from '@tolgee/i18next'; | ||
withTolgee(i18n, ...) | ||
.use(ICU) | ||
const tolgee = Tolgee() | ||
.use(I18nextPlugin()) | ||
.use(FormatSimple()) | ||
.init({ | ||
apiUrl: ..., | ||
apiKey: ..., | ||
}); | ||
withTolgee(i18n, tolgee) | ||
.use(...) | ||
.init(...) | ||
@@ -67,2 +105,58 @@ ``` | ||
To learn more, check [Tolgee docs](https://toolkit.tolgee.io/docs). | ||
To learn more, check [Tolgee documentation](https://toolkit.tolgee.io/js-sdk). | ||
## Why to use Tolgee? | ||
Because it saves a lot of time, you would spend on localization tasks without it. Because it enables you to provide perfectly translated software. | ||
### Features | ||
- All-in-one localization solution for your JS application 🙌 | ||
- Out-of-box in-context localization 🎉 | ||
- Automated screenshot generation 📷 | ||
- Translation management platform 🎈 | ||
- Open-source 🔥 | ||
![Frame 47](https://user-images.githubusercontent.com/18496315/188637819-ac4eb02d-7859-4ca8-9807-27818a52782d.png) | ||
Read more on the [Tolgee website](https://tolgee.io) | ||
## Development | ||
We welcome your PRs. | ||
To develop the package locally: | ||
1. Clone [the repository](https://github.com/tolgee/tolgee-js) | ||
1. Install the packages in the repository root | ||
``` | ||
pnpm install | ||
``` | ||
1. Run the development script | ||
``` | ||
pnpm develop:react-i18n | ||
``` | ||
This runs the development suite of this monorepo for the `react-i18n` integration. The changes in each dependency package are | ||
automatically built and propagated to the test application, which you can open and play within the browser. | ||
### Testing | ||
To run Jest tests of this package, execute | ||
``` | ||
npm run test | ||
``` | ||
In the `/packages/i18next` directory. | ||
## Contributors | ||
<a href="https://github.com/tolgee/tolgee-platform/graphs/contributors"> | ||
<img alt="contributors" src="https://contrib.rocks/image?repo=tolgee/tolgee-js"/> | ||
</a> | ||
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
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
189728
32
162
912
+ Added@tolgee/core@5.0.0-rc.8558283.0(transitive)
+ Added@tolgee/web@5.0.0-rc.8558283.0(transitive)
- Removed@tolgee/core@5.0.0-alpha.1(transitive)
- Removed@tolgee/web@5.0.0-alpha.1(transitive)