@nocobase/plugin-localization 2.1.0-alpha.13 → 2.1.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +7 -7
- package/package.json +2 -2
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ahooks"),require("react-i18next"),require("@formily/core"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-localization",["ahooks","react-i18next","@formily/core","react","antd","@nocobase/client","@formily/react","@ant-design/icons","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-localization"]=t(require("ahooks"),require("react-i18next"),require("@formily/core"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("lodash")):e["@nocobase/plugin-localization"]=t(e.ahooks,e["react-i18next"],e["@formily/core"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e.lodash)}(self,function(e,t,n,r,o,i,a,c,u){return function(){"use strict";var l,s,f,p={872:function(e,t,n){n.d(t,{C:function(){return o},Q:function(){return i}});var r=n(953),o="localization",i=function(){return(0,r.useTranslation)([o,"client"],{nsMode:"fallback"})}},375:function(e){e.exports=c},452:function(e){e.exports=n},230:function(e){e.exports=a},342:function(e){e.exports=i},625:function(t){t.exports=e},59:function(e){e.exports=o},773:function(e){e.exports=u},155:function(e){e.exports=r},953:function(e){e.exports=t}},d={};function y(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}};return p[e](n,n.exports,y),n.exports}y.m=p,y.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return y.d(t,{a:t}),t},y.d=function(e,t){for(var n in t)y.o(t,n)&&!y.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},y.f={},y.e=function(e){return Promise.all(Object.keys(y.f).reduce(function(t,n){return y.f[n](e,t),t},[]))},y.u=function(e){return"df7663068e7c0429.js"},y.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),y.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},b={},y.l=function(e,t,n,r){if(b[e])return void b[e].push(t);if(void 0!==n)for(var o,i,a=document.getElementsByTagName("script"),c=0;c<a.length;c++){var u=a[c];if(u.getAttribute("src")==e||u.getAttribute("data-rspack")=="@nocobase/plugin-localization:"+n){o=u;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,y.nc&&o.setAttribute("nonce",y.nc),o.setAttribute("data-rspack","@nocobase/plugin-localization:"+n),o.src=e),b[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=b[e];if(delete b[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},y.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},y.g.importScripts&&(h=y.g.location+"");var b,h,v=y.g.document;if(!h&&v&&(v.currentScript&&"SCRIPT"===v.currentScript.tagName.toUpperCase()&&(h=v.currentScript.src),!h)){var g=v.getElementsByTagName("script");if(g.length)for(var m=g.length-1;m>-1&&(!h||!/^http(s?):/.test(h));)h=g[m--].src}if(!h)throw Error("Automatic publicPath is not supported in this browser");y.p=h.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),l={889:0},y.f.j=function(e,t){var n=y.o(l,e)?l[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=l[e]=[t,r]});t.push(n[2]=r);var o=y.p+y.u(e),i=Error();y.l(o,function(t){if(y.o(l,e)&&(0!==(n=l[e])&&(l[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},s=function(e,t){var n,r,o=t[0],i=t[1],a=t[2],c=0;if(o.some(function(e){return 0!==l[e]})){for(n in i)y.o(i,n)&&(y.m[n]=i[n]);a&&a(y)}for(e&&e(t);c<o.length;c++)r=o[c],y.o(l,r)&&l[r]&&l[r][0](),l[r]=0},(f=self.webpackChunk_nocobase_plugin_localization=self.webpackChunk_nocobase_plugin_localization||[]).forEach(s.bind(null,0)),f.push=s.bind(null,f.push.bind(f));var w={},x=window.__nocobase_public_path__||"";if(!x&&window.location&&window.location.pathname){var k=window.location.pathname||"/",O=k.indexOf("/v2/");x=O>=0?k.slice(0,O+1):"/"}return x&&(x=x.replace(/\/v2\/?$/,"/")),x||(x="/"),"/"!==x.charAt(x.length-1)&&(x+="/"),y.p=x+"static/plugins/@nocobase/plugin-localization/dist/client/",!function(){y.r(w),y.d(w,{PluginLocalizationClient:function(){return b},default:function(){return h}});var e=y(342),t=y(872),n=y(773),r=y.n(n);function o(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function(){var e;function t(e){var n=this;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");i(this,"context",void 0),i(this,"sentMissingKeys",void 0),i(this,"pendingMissingKeys",void 0),i(this,"submitPendingKeysDebounced",void 0),i(this,"missingKeyHandler",void 0),i(this,"currentLocale",void 0),this.context=e,this.sentMissingKeys=new Set,this.pendingMissingKeys=new Map,this.submitPendingKeysDebounced=r().debounce(function(){n.submitPendingKeys()},t.DEBOUNCE_DELAY)}return e=[{key:"register",value:function(){var e=this,t=this.context.i18n;t.options.saveMissing=!0,this.missingKeyHandler=function(t,n,r){if(e.context.auth.token&&e.context.flowSettingsEnabled&&"client"!==n&&"ui-schema-storage"!==n){var o,i="".concat(n,":").concat(r);if(!(!r||e.sentMissingKeys.has(i)))try{e.currentLocale=null==(o=e.context.i18n)?void 0:o.language,e.sentMissingKeys.add(i),e.pendingMissingKeys.set(i,{key:r,ns:n}),e.submitPendingKeysDebounced()}catch(e){console.error("[i18n] Error in missingKeyHandler:",e)}}},t.on("missingKey",this.missingKeyHandler)}},{key:"unregister",value:function(){var e=this.context.i18n;e.options.saveMissing=!1,this.missingKeyHandler&&(e.off("missingKey",this.missingKeyHandler),this.missingKeyHandler=void 0)}},{key:"isFallbackClient",value:function(e,n){if(e!==t.fallbackNS)return!1;var r=!0,o=!1,i=void 0;try{for(var a,c=this.pendingMissingKeys.values()[Symbol.iterator]();!(r=(a=c.next()).done);r=!0){var u=a.value;if(u.key===n&&u.ns!==t.fallbackNS)return!0}}catch(e){o=!0,i=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}var l=!0,s=!1,f=void 0;try{for(var p,d=this.sentMissingKeys[Symbol.iterator]();!(l=(p=d.next()).done);l=!0){var y=p.value,b=y.indexOf(":");if(b>-1){var h=y.slice(0,b);if(y.slice(b+1)===n&&h!==t.fallbackNS)return!0}}}catch(e){s=!0,f=e}finally{try{l||null==d.return||d.return()}finally{if(s)throw f}}return!1}},{key:"removeClientFallback",value:function(e){e&&this.pendingMissingKeys.delete("".concat(t.fallbackNS,":").concat(e))}},{key:"submitPendingKeys",value:function(){var e;return(e=function(){var e;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(a,"next",{value:u(0)}),c(a,"throw",{value:u(1)}),c(a,"return",{value:u(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function u(c){return function(u){var l=[c,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:if(0===this.pendingMissingKeys.size||!this.context.flowSettingsEnabled)return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),e=Array.from(this.pendingMissingKeys.values()).map(function(e){return{text:e.key,ns:e.ns}}),[4,this.context.api.request({method:"POST",url:"/localizationTexts:missing",skipNotify:!0,skipAuth:!0,data:{keys:e,locale:this.currentLocale}})];case 2:return t.sent(),this.pendingMissingKeys.clear(),[3,4];case 3:return console.error("[i18n] Failed to submit missing keys:",t.sent()),[3,4];case 4:return[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function c(e){o(a,r,i,c,u,"next",e)}function u(e){o(a,r,i,c,u,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),t}();function c(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function u(e,t,n){return(u=p()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&s(o,n.prototype),o}).apply(null,arguments)}i(a,"DEBOUNCE_DELAY",2e3),i(a,"fallbackNS","client");function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){var t="function"==typeof Map?new Map:void 0;return(f=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return u(e,arguments,l(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)})(e)}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}var d=(0,e.lazy)(function(){return y.e("304").then(y.bind(y,339))},"Localization").Localization,b=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=l(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,p()?Reflect.construct(e,t||[],l(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&s(r,e),n=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(a,"next",{value:u(0)}),c(a,"throw",{value:u(1)}),c(a,"return",{value:u(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function u(c){return function(u){var l=[c,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return new a(this.engine.context).register(),this.app.pluginSettingsManager.add(t.C,{title:'{{t("Localization", { ns: "'.concat(t.C,'" })}}'),icon:"GlobalOutlined",Component:d,aclSnippet:"pm.localization.localization"}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){c(i,r,o,a,u,"next",e)}function u(e){c(i,r,o,a,u,"throw",e)}a(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,n),r}(f(e.Plugin)),h=b}(),w}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ahooks"),require("react-i18next"),require("@formily/core"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-localization",["ahooks","react-i18next","@formily/core","react","antd","@nocobase/client","@formily/react","@ant-design/icons","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-localization"]=t(require("ahooks"),require("react-i18next"),require("@formily/core"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("lodash")):e["@nocobase/plugin-localization"]=t(e.ahooks,e["react-i18next"],e["@formily/core"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e.lodash)}(self,function(e,t,n,r,o,i,a,c,u){return function(){"use strict";var l,s,f,p={872:function(e,t,n){n.d(t,{C:function(){return o},Q:function(){return i}});var r=n(953),o="localization",i=function(){return(0,r.useTranslation)([o,"client"],{nsMode:"fallback"})}},375:function(e){e.exports=c},452:function(e){e.exports=n},230:function(e){e.exports=a},342:function(e){e.exports=i},625:function(t){t.exports=e},59:function(e){e.exports=o},773:function(e){e.exports=u},155:function(e){e.exports=r},953:function(e){e.exports=t}},d={};function y(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}};return p[e](n,n.exports,y),n.exports}y.m=p,y.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return y.d(t,{a:t}),t},y.d=function(e,t){for(var n in t)y.o(t,n)&&!y.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},y.f={},y.e=function(e){return Promise.all(Object.keys(y.f).reduce(function(t,n){return y.f[n](e,t),t},[]))},y.u=function(e){return"df7663068e7c0429.js"},y.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),y.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},b={},y.l=function(e,t,n,r){if(b[e])return void b[e].push(t);if(void 0!==n)for(var o,i,a=document.getElementsByTagName("script"),c=0;c<a.length;c++){var u=a[c];if(u.getAttribute("src")==e||u.getAttribute("data-rspack")=="@nocobase/plugin-localization:"+n){o=u;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,y.nc&&o.setAttribute("nonce",y.nc),o.setAttribute("data-rspack","@nocobase/plugin-localization:"+n),o.src=e),b[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=b[e];if(delete b[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},y.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},y.g.importScripts&&(h=y.g.location+"");var b,h,v=y.g.document;if(!h&&v&&(v.currentScript&&"SCRIPT"===v.currentScript.tagName.toUpperCase()&&(h=v.currentScript.src),!h)){var g=v.getElementsByTagName("script");if(g.length)for(var m=g.length-1;m>-1&&(!h||!/^http(s?):/.test(h));)h=g[m--].src}if(!h)throw Error("Automatic publicPath is not supported in this browser");y.p=h.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),l={889:0},y.f.j=function(e,t){var n=y.o(l,e)?l[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=l[e]=[t,r]});t.push(n[2]=r);var o=y.p+y.u(e),i=Error();y.l(o,function(t){if(y.o(l,e)&&(0!==(n=l[e])&&(l[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},s=function(e,t){var n,r,o=t[0],i=t[1],a=t[2],c=0;if(o.some(function(e){return 0!==l[e]})){for(n in i)y.o(i,n)&&(y.m[n]=i[n]);a&&a(y)}for(e&&e(t);c<o.length;c++)r=o[c],y.o(l,r)&&l[r]&&l[r][0](),l[r]=0},(f=self.webpackChunk_nocobase_plugin_localization=self.webpackChunk_nocobase_plugin_localization||[]).forEach(s.bind(null,0)),f.push=s.bind(null,f.push.bind(f));var w={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-localization/dist/client/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",o=r.indexOf("/v2/");e=o>=0?r.slice(0,o+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-localization/dist/client/"}y.p=e}(),!function(){y.r(w),y.d(w,{PluginLocalizationClient:function(){return b},default:function(){return h}});var e=y(342),t=y(872),n=y(773),r=y.n(n);function o(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function(){var e;function t(e){var n=this;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");i(this,"context",void 0),i(this,"sentMissingKeys",void 0),i(this,"pendingMissingKeys",void 0),i(this,"submitPendingKeysDebounced",void 0),i(this,"missingKeyHandler",void 0),i(this,"currentLocale",void 0),this.context=e,this.sentMissingKeys=new Set,this.pendingMissingKeys=new Map,this.submitPendingKeysDebounced=r().debounce(function(){n.submitPendingKeys()},t.DEBOUNCE_DELAY)}return e=[{key:"register",value:function(){var e=this,t=this.context.i18n;t.options.saveMissing=!0,this.missingKeyHandler=function(t,n,r){if(e.context.auth.token&&e.context.flowSettingsEnabled&&"client"!==n&&"ui-schema-storage"!==n){var o,i="".concat(n,":").concat(r);if(!(!r||e.sentMissingKeys.has(i)))try{e.currentLocale=null==(o=e.context.i18n)?void 0:o.language,e.sentMissingKeys.add(i),e.pendingMissingKeys.set(i,{key:r,ns:n}),e.submitPendingKeysDebounced()}catch(e){console.error("[i18n] Error in missingKeyHandler:",e)}}},t.on("missingKey",this.missingKeyHandler)}},{key:"unregister",value:function(){var e=this.context.i18n;e.options.saveMissing=!1,this.missingKeyHandler&&(e.off("missingKey",this.missingKeyHandler),this.missingKeyHandler=void 0)}},{key:"isFallbackClient",value:function(e,n){if(e!==t.fallbackNS)return!1;var r=!0,o=!1,i=void 0;try{for(var a,c=this.pendingMissingKeys.values()[Symbol.iterator]();!(r=(a=c.next()).done);r=!0){var u=a.value;if(u.key===n&&u.ns!==t.fallbackNS)return!0}}catch(e){o=!0,i=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}var l=!0,s=!1,f=void 0;try{for(var p,d=this.sentMissingKeys[Symbol.iterator]();!(l=(p=d.next()).done);l=!0){var y=p.value,b=y.indexOf(":");if(b>-1){var h=y.slice(0,b);if(y.slice(b+1)===n&&h!==t.fallbackNS)return!0}}}catch(e){s=!0,f=e}finally{try{l||null==d.return||d.return()}finally{if(s)throw f}}return!1}},{key:"removeClientFallback",value:function(e){e&&this.pendingMissingKeys.delete("".concat(t.fallbackNS,":").concat(e))}},{key:"submitPendingKeys",value:function(){var e;return(e=function(){var e;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(a,"next",{value:u(0)}),c(a,"throw",{value:u(1)}),c(a,"return",{value:u(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function u(c){return function(u){var l=[c,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:if(0===this.pendingMissingKeys.size||!this.context.flowSettingsEnabled)return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),e=Array.from(this.pendingMissingKeys.values()).map(function(e){return{text:e.key,ns:e.ns}}),[4,this.context.api.request({method:"POST",url:"/localizationTexts:missing",skipNotify:!0,skipAuth:!0,data:{keys:e,locale:this.currentLocale}})];case 2:return t.sent(),this.pendingMissingKeys.clear(),[3,4];case 3:return console.error("[i18n] Failed to submit missing keys:",t.sent()),[3,4];case 4:return[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function c(e){o(a,r,i,c,u,"next",e)}function u(e){o(a,r,i,c,u,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),t}();function c(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function u(e,t,n){return(u=p()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&s(o,n.prototype),o}).apply(null,arguments)}i(a,"DEBOUNCE_DELAY",2e3),i(a,"fallbackNS","client");function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){var t="function"==typeof Map?new Map:void 0;return(f=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return u(e,arguments,l(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)})(e)}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}var d=(0,e.lazy)(function(){return y.e("304").then(y.bind(y,339))},"Localization").Localization,b=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=l(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,p()?Reflect.construct(e,t||[],l(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&s(r,e),n=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(a,"next",{value:u(0)}),c(a,"throw",{value:u(1)}),c(a,"return",{value:u(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function u(c){return function(u){var l=[c,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return new a(this.engine.context).register(),this.app.pluginSettingsManager.add(t.C,{title:'{{t("Localization", { ns: "'.concat(t.C,'" })}}'),icon:"GlobalOutlined",Component:d,aclSnippet:"pm.localization.localization"}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){c(i,r,o,a,u,"next",e)}function u(e){c(i,r,o,a,u,"throw",e)}a(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,n),r}(f(e.Plugin)),h=b}(),w}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -11,16 +11,16 @@ module.exports = {
|
|
|
11
11
|
"@ant-design/icons": "5.6.1",
|
|
12
12
|
"@formily/core": "2.3.7",
|
|
13
13
|
"@formily/react": "2.3.7",
|
|
14
|
-
"@nocobase/client": "2.1.0-alpha.
|
|
14
|
+
"@nocobase/client": "2.1.0-alpha.14",
|
|
15
15
|
"ahooks": "3.7.8",
|
|
16
16
|
"antd": "5.24.2",
|
|
17
17
|
"react": "18.2.0",
|
|
18
|
-
"@nocobase/flow-engine": "2.1.0-alpha.
|
|
18
|
+
"@nocobase/flow-engine": "2.1.0-alpha.14",
|
|
19
19
|
"lodash": "4.17.21",
|
|
20
|
-
"@nocobase/database": "2.1.0-alpha.
|
|
21
|
-
"@nocobase/server": "2.1.0-alpha.
|
|
22
|
-
"@nocobase/utils": "2.1.0-alpha.
|
|
23
|
-
"@nocobase/cache": "2.1.0-alpha.
|
|
24
|
-
"@nocobase/actions": "2.1.0-alpha.
|
|
20
|
+
"@nocobase/database": "2.1.0-alpha.14",
|
|
21
|
+
"@nocobase/server": "2.1.0-alpha.14",
|
|
22
|
+
"@nocobase/utils": "2.1.0-alpha.14",
|
|
23
|
+
"@nocobase/cache": "2.1.0-alpha.14",
|
|
24
|
+
"@nocobase/actions": "2.1.0-alpha.14",
|
|
25
25
|
"react-i18next": "11.18.6"
|
|
26
26
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-localization",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.14",
|
|
4
4
|
"main": "dist/server/index.js",
|
|
5
5
|
"homepage": "https://docs.nocobase.com/handbook/localization-management",
|
|
6
6
|
"homepage.ru-RU": "https://docs-ru.nocobase.com/handbook/localization-management",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"description": "Allows to manage localization resources of the application.",
|
|
26
26
|
"description.ru-RU": "Позволяет управлять ресурсами локализации приложения.",
|
|
27
27
|
"description.zh-CN": "支持管理应用程序的本地化资源。",
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "d8735b541de0ff9557bba704de49c799b4962672"
|
|
29
29
|
}
|