@nocobase/plugin-localization 2.1.0-alpha.34 → 2.1.0-alpha.35

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.
Files changed (33) hide show
  1. package/client-v2.d.ts +2 -0
  2. package/client-v2.js +1 -0
  3. package/dist/ai/ai-employees/lina.d.ts +10 -0
  4. package/dist/ai/ai-employees/lina.js +60 -0
  5. package/dist/client/300.3a4b9b688d36da96.js +10 -0
  6. package/dist/client/i18n-missing-handler.d.ts +1 -17
  7. package/dist/client/index.js +1 -1
  8. package/dist/client-v2/796.b9d793cda3c8b932.js +10 -0
  9. package/dist/client-v2/common/constants.d.ts +13 -0
  10. package/dist/client-v2/common/i18n-missing-handler.d.ts +23 -0
  11. package/dist/{client/Localization.d.ts → client-v2/i18n-missing-handler.d.ts} +1 -2
  12. package/dist/client-v2/index.d.ts +9 -0
  13. package/dist/client-v2/index.js +10 -0
  14. package/dist/client-v2/locale.d.ts +11 -0
  15. package/dist/client-v2/pages/LocalizationPage.d.ts +11 -0
  16. package/dist/client-v2/plugin.d.ts +13 -0
  17. package/dist/externalVersion.js +16 -12
  18. package/dist/locale/en-US.json +15 -1
  19. package/dist/locale/zh-CN.json +15 -1
  20. package/dist/server/actions/aiTranslate.d.ts +14 -0
  21. package/dist/server/actions/aiTranslate.js +127 -0
  22. package/dist/server/actions/localization.js +30 -15
  23. package/dist/server/actions/localizationTexts.js +8 -9
  24. package/dist/server/migrations/20260511230000-delete-official-plugin-package-resource-modules.d.ts +14 -0
  25. package/dist/server/migrations/20260511230000-delete-official-plugin-package-resource-modules.js +64 -0
  26. package/dist/server/plugin.d.ts +5 -2
  27. package/dist/server/plugin.js +72 -14
  28. package/dist/server/tasks/localization-ai-translate.d.ts +31 -0
  29. package/dist/server/tasks/localization-ai-translate.js +596 -0
  30. package/package.json +7 -2
  31. package/dist/client/304.6a0dd0c975aa0b7c.js +0 -10
  32. package/dist/server/source-manager.d.ts +0 -35
  33. package/dist/server/source-manager.js +0 -77
package/client-v2.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/client-v2';
2
+ export { default } from './dist/client-v2';
package/client-v2.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/client-v2/index.js');
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ declare const _default: import("@nocobase/ai").AIEmployeeOptions;
10
+ export default _default;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var lina_exports = {};
28
+ __export(lina_exports, {
29
+ default: () => lina_default
30
+ });
31
+ module.exports = __toCommonJS(lina_exports);
32
+ var import_ai = require("@nocobase/ai");
33
+ var lina_default = (0, import_ai.defineAIEmployee)({
34
+ username: "lina",
35
+ category: "developer",
36
+ description: "AI employee for system localization",
37
+ avatar: "nocobase-052-female",
38
+ nickname: "Lina",
39
+ position: "Localization engineer",
40
+ bio: "I translate NocoBase system resources into concise, accurate interface text while preserving placeholders and formatting.",
41
+ greeting: "Hi, I am Lina. I can help translate localization resources for your system.",
42
+ chatSettings: {
43
+ systemPromptMode: "none",
44
+ enableSkills: false,
45
+ enableTools: false
46
+ },
47
+ systemPrompt: `You are Lina, a professional localization engineer for NocoBase.
48
+
49
+ Your job is to translate system interface text into the requested target locale.
50
+
51
+ # Rules
52
+ - Return only the translated text.
53
+ - Do not explain, summarize, wrap in quotes, or use Markdown.
54
+ - Preserve placeholders, variables, HTML tags, ICU syntax, punctuation placeholders, and code-like tokens exactly.
55
+ - Preserve line breaks when they are meaningful.
56
+ - Keep UI text concise and natural for product interfaces.
57
+ - If the source text should not be translated, return it unchanged.
58
+ - If a glossary or context is provided, follow it.
59
+ `
60
+ });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ "use strict";(self.webpackChunk_nocobase_plugin_localization=self.webpackChunk_nocobase_plugin_localization||[]).push([["300"],{151:function(e,t,n){n.r(t),n.d(t,{default:function(){return x},LocalizationPageContent:function(){return O}});var r=n(375),l=n(230),a=n(485),o=n(694),i=n(550),u=n(625),c=n(59),s=n(155),d=n.n(s),m="localization",f="localizationTranslations",p=JSON.parse('{"UU":"@nocobase/plugin-localization"}').UU;function h(){var e=(0,o.useFlowEngine)();return function(t){return e.context.t(t,{ns:[p,"client"]})}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t,n,r,l,a,o){try{var i=e[a](o),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,l)}function v(e){return function(){var t=this,n=arguments;return new Promise(function(r,l){var a=e.apply(t,n);function o(e){y(a,r,l,o,i,"next",e)}function i(e){y(a,r,l,o,i,"throw",e)}o(void 0)})}}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function E(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function w(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,l=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var a=[],o=!0,i=!1;try{for(l=l.call(e);!(o=(n=l.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==l.return||l.return()}finally{if(i)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return g(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(o,"next",{value:u(0)}),i(o,"throw",{value:u(1)}),i(o,"return",{value:u(2)}),"function"==typeof Symbol&&i(o,Symbol.iterator,{value:function(){return this}}),o;function u(i){return function(u){var c=[i,u];if(n)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&c[0]?r.return:c[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,c[1])).done)return l;switch(r=0,l&&(c=[2&c[0],l.value]),c[0]){case 0:case 1:l=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(l=(l=a.trys).length>0&&l[l.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!l||c[1]>l[0]&&c[1]<l[3])){a.label=c[1];break}if(6===c[0]&&a.label<l[1]){a.label=l[1],l=c;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(c);break}l[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],r=0}finally{n=l=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var C=c.Typography.Text;function T(e,t){return l.Schema.compile(e,{t:t})}var k=function(e){var t=e.value;return null==t?null:d().createElement("span",null,t)};function x(){return d().createElement(O,null)}function O(){var e,t,n,l=(0,o.useFlowContext)(),i=h(),p=l.app.apiClient,g=(null==(e=(t=p.auth).getLocale)?void 0:e.call(t))||p.auth.locale||"en-US",y=w(c.Form.useForm(),1)[0],x=w((0,s.useState)({page:1,pageSize:50,hasTranslation:!0}),2),O=x[0],j=x[1],I=w((0,s.useState)([]),2),F=I[0],A=I[1],D=w((0,s.useState)(null),2),R=D[0],B=D[1],M=(null==(n=a.languageCodes[g])?void 0:n.label)||g,U=(0,u.useRequest)(function(){return v(function(){return S(this,function(e){switch(e.label){case 0:return[4,p.resource("localizationTexts").list(E(b({},O),{hasTranslation:String(O.hasTranslation)}))];case 1:var t,n,r,l,a,o;return[2,{rows:(null==(o=null==(t=e.sent())?void 0:t.data)?void 0:o.data)||[],modules:(null==o||null==(n=o.meta)?void 0:n.modules)||[],count:(null==o||null==(r=o.meta)?void 0:r.count)||0,page:null==o||null==(l=o.meta)?void 0:l.page,pageSize:null==o||null==(a=o.meta)?void 0:a.pageSize}]}})})()},{refreshDeps:[O]}),K=U.data,L=U.loading,_=U.refresh,q=(0,u.useRequest)(function(){return v(function(){var e,t;return S(this,function(n){switch(n.label){case 0:return[4,p.resource(m).getSources()];case 1:return[2,(null==(t=n.sent())||null==(e=t.data)?void 0:e.data)||[]]}})})()}),G=q.data,N=q.loading,J=(null==K?void 0:K.rows)||[],V=(0,s.useMemo)(function(){return((null==K?void 0:K.modules)||[]).map(function(e){return{value:e.value,label:T(e.label,i)}})},[null==K?void 0:K.modules,i]);(0,s.useEffect)(function(){R?y.setFieldsValue({translation:R.translation}):y.resetFields()},[R,y]);var W=function(e){j(function(t){return E(b({},t,e),{page:1})})},$=[{title:i("Text"),dataIndex:"text",ellipsis:!0},{title:i("Translation"),dataIndex:"translation",ellipsis:!0,render:function(e){return d().createElement(k,{value:e})}},{title:i("Module"),dataIndex:"moduleTitle",width:220,render:function(e,t){return t.moduleTitle?d().createElement(c.Tag,null,T(t.moduleTitle,i)):d().createElement(c.Tag,null,t.module)}},{title:i("Actions"),key:"actions",width:240,render:function(e,t){return d().createElement(c.Space,{split:d().createElement(c.Divider,{type:"vertical"}),style:{whiteSpace:"nowrap"}},d().createElement(c.Button,{type:"link",size:"small",onClick:function(){return B(t)}},i("Edit")),t.translationId?d().createElement(c.Popconfirm,{title:i("Delete translation"),description:i("Are you sure you want to delete it?"),onConfirm:function(){return v(function(){return S(this,function(e){switch(e.label){case 0:if(!t.translationId)return[2];return[4,p.resource(f).destroy({filterByTk:t.translationId})];case 1:return e.sent(),_(),[2]}})})()}},d().createElement(c.Button,{type:"link",size:"small"},i("Delete translation"))):null)}}],H={current:(null==K?void 0:K.page)||O.page,pageSize:(null==K?void 0:K.pageSize)||O.pageSize,total:(null==K?void 0:K.count)||0,showSizeChanger:!0,onChange:function(e,t){return j(function(n){return E(b({},n),{page:e,pageSize:t})})}};return d().createElement(c.Card,{bordered:!1},d().createElement(c.Space,{direction:"vertical",size:16,style:{width:"100%"}},d().createElement(c.Row,{justify:"space-between",align:"middle",gutter:[16,16]},d().createElement(c.Col,{flex:"auto"},d().createElement(c.Space,{wrap:!0,align:"center"},d().createElement(c.Typography,null,d().createElement(C,{strong:!0},i("Current language")),d().createElement(c.Tag,{style:{marginLeft:10}},M)),d().createElement(c.Select,{allowClear:!0,showSearch:!0,optionFilterProp:"label",placeholder:i("Module"),style:{minWidth:220},options:V,onChange:function(e){return W({module:e})}}),d().createElement(c.Input.Search,{allowClear:!0,placeholder:i("Keyword"),style:{width:220},onSearch:function(e){return W({keyword:e})}}),d().createElement(c.Radio.Group,{optionType:"button",value:O.hasTranslation,onChange:function(e){return W({hasTranslation:e.target.value})},options:[{label:i("All"),value:!0},{label:i("No translation"),value:!1}]}))),d().createElement(c.Col,null,d().createElement(c.Space,{wrap:!0,align:"center"},d().createElement(c.Popconfirm,{title:i("Delete translation"),description:i("Are you sure you want to delete it?"),onConfirm:function(){return v(function(){var e,t;return S(this,function(n){switch(n.label){case 0:if(e=new Set(F.map(function(e){return String(e)})),!(t=J.filter(function(t){return e.has(String(t.id))}).map(function(e){return e.translationId}).filter(Boolean)).length)return c.message.error(i("Please select the records you want to delete")),[2];return[4,p.resource(f).destroy({filterByTk:t})];case 1:return n.sent(),A([]),_(),[2]}})})()}},d().createElement(c.Button,{danger:!0,disabled:!F.length},i("Delete translation"))),d().createElement(c.Button,{icon:d().createElement(r.ReloadOutlined,null),loading:L,onClick:_},i("Refresh")),d().createElement(z,{sources:void 0===G?[]:G,loading:N,refresh:_}),d().createElement(c.Button,{type:"primary",icon:d().createElement(r.UploadOutlined,null),onClick:function(){return v(function(){return S(this,function(e){switch(e.label){case 0:return[4,p.resource(m).publish()];case 1:return e.sent(),window.location.reload(),[2]}})})()}},i("Publish")),d().createElement(P,{selectedRowKeys:F})))),d().createElement(c.Table,{rowKey:"id",loading:L,columns:$,dataSource:J,pagination:H,rowSelection:{selectedRowKeys:F,onChange:A}})),d().createElement(c.Drawer,{title:i("Edit"),open:!!R,width:720,onClose:function(){return B(null)},footer:d().createElement(c.Space,{style:{display:"flex",justifyContent:"flex-end"}},d().createElement(c.Button,{onClick:function(){return B(null)}},i("Cancel")),d().createElement(c.Button,{type:"primary",onClick:function(){return v(function(){var e;return S(this,function(t){switch(t.label){case 0:return[4,y.validateFields()];case 1:if(e=t.sent(),!R)return[2];return[4,p.resource(f).updateOrCreate({filterKeys:["textId","locale"],values:{textId:R.id,locale:g,translation:e.translation}})];case 2:return t.sent(),B(null),_(),[2]}})})()}},i("Submit")))},R?d().createElement(c.Space,{direction:"vertical",size:16,style:{width:"100%"}},d().createElement("div",null,d().createElement(C,{strong:!0},i("Module")),d().createElement("div",{style:{marginTop:8}},R.moduleTitle?d().createElement(c.Tag,null,T(R.moduleTitle,i)):d().createElement(c.Tag,null,R.module))),d().createElement("div",null,d().createElement(C,{strong:!0},i("Text")),d().createElement(c.Typography.Paragraph,{style:{marginTop:8}},R.text)),d().createElement(c.Form,{form:y,layout:"vertical"},d().createElement(c.Form.Item,{name:"translation",label:d().createElement(C,{strong:!0},i("Translation")),rules:[{required:!0,message:i("Translation")}]},d().createElement(c.Input.TextArea,{autoSize:{minRows:4}})))):null))}function P(e){var t,n,r,a=e.selectedRowKeys,u=(0,o.useFlowContext)(),f=h(),p=u.app.apiClient,g=(null==(t=(n=p.auth).getLocale)?void 0:t.call(n))||p.auth.locale||"en-US",y=w((0,s.useState)(null),2),b=y[0],E=y[1],C=[{mode:"incremental",title:f("Incremental translation")},{mode:"selected",title:f("Selected translation")},{mode:"full",title:f("Full translation")}];return d().createElement(i.AIEmployeeShortcut,{aiEmployee:{username:"lina"},tasks:C,size:32,mask:!1,onTaskClick:function(e){var t;return t=e.mode,v(function(){var e,n,r,o,u,s,h;return S(this,function(y){switch(y.label){case 0:if("selected"===t&&!a.length)return c.message.error(f("Please select the records you want to translate")),[2];E(t),y.label=1;case 1:return y.trys.push([1,5,6,7]),n={mode:t,locale:g,employeeUsername:"lina",textIds:"selected"===t?a:void 0},[4,p.resource(m).aiTranslatePreview({values:n})];case 2:return u=(null==(o=(null==(r=y.sent())||null==(e=r.data)?void 0:e.data)||(null==r?void 0:r.data))?void 0:o.providerTitle)?l.Schema.compile(o.providerTitle,{t:f}):null==o?void 0:o.provider,s=(null==o?void 0:o.model)?(0,i.formatModelLabel)(o.model):void 0,[4,new Promise(function(e){var t;c.Modal.confirm({title:f("Confirm translation task"),content:d().createElement(c.Space,{direction:"vertical",size:8},d().createElement("div",null,f("Entries to translate"),": ",null!=(t=null==o?void 0:o.count)?t:0),d().createElement("div",null,f("Provider"),": ",u||"-"),d().createElement("div",null,f("Model"),": ",s||"-")),okText:f("Confirm"),cancelText:f("Cancel"),onOk:function(){return e(!0)},onCancel:function(){return e(!1)}})})];case 3:if(!y.sent())return[2];return[4,p.resource(m).aiTranslate({values:n})];case 4:return y.sent(),c.message.success(f("Async task created")),[3,7];case 5:return h=y.sent(),c.message.error((null==h?void 0:h.message)||f("Failed to create async task")),[3,7];case 6:return E(null),[7];case 7:return[2]}})})()},loadingTaskTitle:null==(r=C.find(function(e){return e.mode===b}))?void 0:r.title,taskLoadingTitle:f("Creating...")})}function z(e){var t=e.sources,n=e.loading,l=e.refresh,a=(0,o.useFlowContext)(),i=h(),u=a.app.apiClient,f=w((0,s.useState)([]),2),p=f[0],g=f[1],y=w((0,s.useState)(!1),2),b=y[0],E=y[1],C=w((0,s.useState)(!1),2),k=C[0],x=C[1],O=(0,s.useMemo)(function(){return t.map(function(e){return e.name})},[t]);(0,s.useEffect)(function(){g(O)},[O]);var P=p.length>0&&p.length<O.length,z=O.length>0&&p.length===O.length;if(n)return null;var j=d().createElement(d().Fragment,null,d().createElement(c.Checkbox,{indeterminate:P,onChange:function(e){g(e.target.checked?O:[])},checked:z},i("All")),d().createElement(c.Divider,{style:{margin:"5px 0"}}),d().createElement(c.Checkbox.Group,{onChange:function(e){g(e)},value:p},d().createElement("div",null,t.map(function(e){return d().createElement("div",{key:e.name},d().createElement(c.Checkbox,{value:e.name},T(e.title,i)))}))),d().createElement(c.Divider,{style:{margin:"5px 0"}}),d().createElement(c.Checkbox,{checked:b,onChange:function(e){return E(e.target.checked)}},i("Reset built-in translations")));return d().createElement(c.Popover,{placement:"bottomRight",content:j},d().createElement(c.Button,{icon:d().createElement(r.SyncOutlined,null),loading:k,onClick:function(){return v(function(){return S(this,function(e){switch(e.label){case 0:if(!p.length)return[2,c.message.error(i("Please select the resources you want to synchronize"))];x(!0),e.label=1;case 1:return e.trys.push([1,,3,4]),[4,u.resource(m).sync({values:{types:p,resetTranslations:b}})];case 2:return e.sent(),l(),[3,4];case 3:return x(!1),[7];case 4:return[2]}})})()}},i("Sync")))}}}]);
@@ -6,20 +6,4 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { FlowEngineContext } from '@nocobase/flow-engine';
10
- export declare class MissingKeyHandler {
11
- private context;
12
- static DEBOUNCE_DELAY: number;
13
- static fallbackNS: string;
14
- private sentMissingKeys;
15
- private pendingMissingKeys;
16
- private submitPendingKeysDebounced;
17
- private missingKeyHandler;
18
- private currentLocale?;
19
- constructor(context: FlowEngineContext);
20
- register(): void;
21
- unregister(): void;
22
- private isFallbackClient;
23
- private removeClientFallback;
24
- private submitPendingKeys;
25
- }
9
+ export { MissingKeyHandler } from '../client-v2/common/i18n-missing-handler';
@@ -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""+e+".6a0dd0c975aa0b7c.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}()});
10
+ !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("ahooks"),require("react-i18next"),require("@nocobase/client-v2"),require("@nocobase/plugin-ai/client-v2"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-localization",["ahooks","react-i18next","@nocobase/client-v2","@nocobase/plugin-ai/client-v2","react","antd","@nocobase/client","@formily/react","@ant-design/icons","@nocobase/flow-engine","lodash"],n):"object"==typeof exports?exports["@nocobase/plugin-localization"]=n(require("ahooks"),require("react-i18next"),require("@nocobase/client-v2"),require("@nocobase/plugin-ai/client-v2"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):e["@nocobase/plugin-localization"]=n(e.ahooks,e["react-i18next"],e["@nocobase/client-v2"],e["@nocobase/plugin-ai/client-v2"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e.lodash)}(self,function(e,n,t,r,o,i,a,c,u,l,s){return function(){"use strict";var f,p,b,d={375:function(e){e.exports=u},230:function(e){e.exports=c},342:function(e){e.exports=a},485:function(e){e.exports=t},694:function(e){e.exports=l},550:function(e){e.exports=r},625:function(n){n.exports=e},59:function(e){e.exports=i},773:function(e){e.exports=s},155:function(e){e.exports=o},953:function(e){e.exports=n}},h={};function y(e){var n=h[e];if(void 0!==n)return n.exports;var t=h[e]={exports:{}};return d[e](t,t.exports,y),t.exports}y.m=d,y.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return y.d(n,{a:n}),n},y.d=function(e,n){for(var t in n)y.o(n,t)&&!y.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},y.f={},y.e=function(e){return Promise.all(Object.keys(y.f).reduce(function(n,t){return y.f[t](e,n),n},[]))},y.u=function(e){return""+e+".3a4b9b688d36da96.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,n){return Object.prototype.hasOwnProperty.call(e,n)},v={},y.l=function(e,n,t,r){if(v[e])return void v[e].push(n);if(void 0!==t)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:"+t){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:"+t),o.src=e),v[e]=[n];var l=function(n,t){o.onerror=o.onload=null,clearTimeout(s);var r=v[e];if(delete v[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(t)}),n)return n(t)},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&&(g=y.g.location+"");var v,g,m=y.g.document;if(!g&&m&&(m.currentScript&&"SCRIPT"===m.currentScript.tagName.toUpperCase()&&(g=m.currentScript.src),!g)){var w=m.getElementsByTagName("script");if(w.length)for(var x=w.length-1;x>-1&&(!g||!/^http(s?):/.test(g));)g=w[x--].src}if(!g)throw Error("Automatic publicPath is not supported in this browser");y.p=g.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),f={889:0},y.f.j=function(e,n){var t=y.o(f,e)?f[e]:void 0;if(0!==t)if(t)n.push(t[2]);else{var r=new Promise(function(n,r){t=f[e]=[n,r]});n.push(t[2]=r);var o=y.p+y.u(e),i=Error();y.l(o,function(n){if(y.o(f,e)&&(0!==(t=f[e])&&(f[e]=void 0),t)){var r=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,t[1](i)}},"chunk-"+e,e)}},p=function(e,n){var t,r,o=n[0],i=n[1],a=n[2],c=0;if(o.some(function(e){return 0!==f[e]})){for(t in i)y.o(i,t)&&(y.m[t]=i[t]);a&&a(y)}for(e&&e(n);c<o.length;c++)r=o[c],y.o(f,r)&&f[r]&&f[r][0](),f[r]=0},(b=self.webpackChunk_nocobase_plugin_localization=self.webpackChunk_nocobase_plugin_localization||[]).forEach(p.bind(null,0)),b.push=p.bind(null,b.push.bind(b));var k={};return!function(){var e="",n="u">typeof document?document.currentScript:null;if(n&&n.src&&(e=n.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var t=window.__webpack_public_path__||"";t&&("/"!==t.charAt(t.length-1)&&(t+="/"),e=t+"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(k),y.d(k,{PluginLocalizationClient:function(){return m},default:function(){return w}});var e=y(342),n=y(59),t=y(155),r=y.n(t);y(953);var o="localization",i=y(773),a=y.n(i);function c(e,n,t,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){t(e);return}c.done?n(u):Promise.resolve(u).then(r,o)}function u(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var l=function(){var e;function n(e){var t=this;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");u(this,"context",void 0),u(this,"sentMissingKeys",void 0),u(this,"pendingMissingKeys",void 0),u(this,"submitPendingKeysDebounced",void 0),u(this,"missingKeyHandler",void 0),u(this,"currentLocale",void 0),this.context=e,this.sentMissingKeys=new Set,this.pendingMissingKeys=new Map,this.submitPendingKeysDebounced=a().debounce(function(){t.submitPendingKeys()},n.DEBOUNCE_DELAY)}return e=[{key:"register",value:function(){var e=this,n=this.context.i18n;n.options.saveMissing=!0,this.missingKeyHandler=function(n,t,r){if(e.context.auth.token&&e.context.flowSettingsEnabled&&"client"!==t&&"ui-schema-storage"!==t){var o,i="".concat(t,":").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:t}),e.submitPendingKeysDebounced()}catch(e){console.error("[i18n] Error in missingKeyHandler:",e)}}},n.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:"submitPendingKeys",value:function(){var e;return(e=function(){var e;return function(e,n){var t,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(t)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(t=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=n.call(e,i)}catch(e){l=[6,e],r=0}finally{t=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:if(0===this.pendingMissingKeys.size||!this.context.flowSettingsEnabled)return[2];n.label=1;case 1:return n.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 n.sent(),this.pendingMissingKeys.clear(),[3,4];case 3:return console.error("[i18n] Failed to submit missing keys:",n.sent()),[3,4];case 4:return[2]}})},function(){var n=this,t=arguments;return new Promise(function(r,o){var i=e.apply(n,t);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,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,e),n}();function s(e,n,t,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){t(e);return}c.done?n(u):Promise.resolve(u).then(r,o)}function f(e,n,t){return(f=h()?Reflect.construct:function(e,n,t){var r=[null];r.push.apply(r,n);var o=new(Function.bind.apply(e,r));return t&&b(o,t.prototype),o}).apply(null,arguments)}u(l,"DEBOUNCE_DELAY",2e3),u(l,"fallbackNS","client");function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,n){return(b=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e})(e,n)}function d(e){var n="function"==typeof Map?new Map:void 0;return(d=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!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return f(e,arguments,p(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),b(t,e)})(e)}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}var v=(0,e.lazy)(function(){return y.e("300").then(y.bind(y,151))}),g=function(e){var t,o,i=e.payload;return r().createElement(n.Typography.Text,null,null!=(t=null==i?void 0:i.translated)?t:0," / ",null!=(o=null==i?void 0:i.total)?o:0)},m=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,n;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return e=t,n=arguments,e=p(e),function(e,n){var t;if(n&&("object"==((t=n)&&"u">typeof Symbol&&t.constructor===Symbol?"symbol":typeof t)||"function"==typeof n))return n;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,h()?Reflect.construct(e,n||[],p(this).constructor):e.apply(this,n))}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&b(t,e),n=[{key:"load",value:function(){var e;return(e=function(){var e;return function(e,n){var t,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(t)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(t=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=n.call(e,i)}catch(e){l=[6,e],r=0}finally{t=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(n){return new l(this.engine.context).register(),this.app.pluginSettingsManager.add(o,{title:'{{t("Localization", { ns: "'.concat(o,'" })}}'),icon:"GlobalOutlined",Component:v,aclSnippet:"pm.localization.localization"}),null==(e=this.app.pm.get("async-task-manager"))||e.taskOrigins.register("localization",{Result:g,namespace:o}),[2]})},function(){var n=this,t=arguments;return new Promise(function(r,o){var i=e.apply(n,t);function a(e){s(i,r,o,a,c,"next",e)}function c(e){s(i,r,o,a,c,"throw",e)}a(void 0)})}).call(this)}}],function(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),t}(d(e.Plugin)),w=m}(),k}()});
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ "use strict";(self.webpackChunk_nocobase_plugin_localization_client_v2=self.webpackChunk_nocobase_plugin_localization_client_v2||[]).push([["796"],{647:function(e,t,n){n.r(t),n.d(t,{default:function(){return k},LocalizationPageContent:function(){return O}});var r=n(375),l=n(230),a=n(485),o=n(694),i=n(550),u=n(625),c=n(59),s=n(155),d=n.n(s),f=n(941),m=JSON.parse('{"UU":"@nocobase/plugin-localization"}').UU;function p(){var e=(0,o.useFlowEngine)();return function(t){return e.context.t(t,{ns:[m,"client"]})}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t,n,r,l,a,o){try{var i=e[a](o),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,l)}function g(e){return function(){var t=this,n=arguments;return new Promise(function(r,l){var a=e.apply(t,n);function o(e){v(a,r,l,o,i,"next",e)}function i(e){v(a,r,l,o,i,"throw",e)}o(void 0)})}}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function b(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,l=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var a=[],o=!0,i=!1;try{for(l=l.call(e);!(o=(n=l.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==l.return||l.return()}finally{if(i)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return h(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(o,"next",{value:u(0)}),i(o,"throw",{value:u(1)}),i(o,"return",{value:u(2)}),"function"==typeof Symbol&&i(o,Symbol.iterator,{value:function(){return this}}),o;function u(i){return function(u){var c=[i,u];if(n)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&c[0]?r.return:c[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,c[1])).done)return l;switch(r=0,l&&(c=[2&c[0],l.value]),c[0]){case 0:case 1:l=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(l=(l=a.trys).length>0&&l[l.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!l||c[1]>l[0]&&c[1]<l[3])){a.label=c[1];break}if(6===c[0]&&a.label<l[1]){a.label=l[1],l=c;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(c);break}l[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],r=0}finally{n=l=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var S=c.Typography.Text;function C(e,t){return l.Schema.compile(e,{t:t})}var T=function(e){var t=e.value;return null==t?null:d().createElement("span",null,t)};function k(){return d().createElement(O,null)}function O(){var e,t,n,l=(0,o.useFlowContext)(),i=p(),m=l.app.apiClient,h=(null==(e=(t=m.auth).getLocale)?void 0:e.call(t))||m.auth.locale||"en-US",v=E(c.Form.useForm(),1)[0],k=E((0,s.useState)({page:1,pageSize:50,hasTranslation:!0}),2),O=k[0],j=k[1],z=E((0,s.useState)([]),2),I=z[0],F=z[1],A=E((0,s.useState)(null),2),D=A[0],M=A[1],R=(null==(n=a.languageCodes[h])?void 0:n.label)||h,B=(0,u.useRequest)(function(){return g(function(){return w(this,function(e){switch(e.label){case 0:return[4,m.resource(f.qQ).list(b(y({},O),{hasTranslation:String(O.hasTranslation)}))];case 1:var t,n,r,l,a,o;return[2,{rows:(null==(o=null==(t=e.sent())?void 0:t.data)?void 0:o.data)||[],modules:(null==o||null==(n=o.meta)?void 0:n.modules)||[],count:(null==o||null==(r=o.meta)?void 0:r.count)||0,page:null==o||null==(l=o.meta)?void 0:l.page,pageSize:null==o||null==(a=o.meta)?void 0:a.pageSize}]}})})()},{refreshDeps:[O]}),_=B.data,U=B.loading,K=B.refresh,L=(0,u.useRequest)(function(){return g(function(){var e,t;return w(this,function(n){switch(n.label){case 0:return[4,m.resource(f.ft).getSources()];case 1:return[2,(null==(t=n.sent())||null==(e=t.data)?void 0:e.data)||[]]}})})()}),q=L.data,G=L.loading,Y=(null==_?void 0:_.rows)||[],N=(0,s.useMemo)(function(){return((null==_?void 0:_.modules)||[]).map(function(e){return{value:e.value,label:C(e.label,i)}})},[null==_?void 0:_.modules,i]);(0,s.useEffect)(function(){D?v.setFieldsValue({translation:D.translation}):v.resetFields()},[D,v]);var J=function(e){j(function(t){return b(y({},t,e),{page:1})})},Q=[{title:i("Text"),dataIndex:"text",ellipsis:!0},{title:i("Translation"),dataIndex:"translation",ellipsis:!0,render:function(e){return d().createElement(T,{value:e})}},{title:i("Module"),dataIndex:"moduleTitle",width:220,render:function(e,t){return t.moduleTitle?d().createElement(c.Tag,null,C(t.moduleTitle,i)):d().createElement(c.Tag,null,t.module)}},{title:i("Actions"),key:"actions",width:240,render:function(e,t){return d().createElement(c.Space,{split:d().createElement(c.Divider,{type:"vertical"}),style:{whiteSpace:"nowrap"}},d().createElement(c.Button,{type:"link",size:"small",onClick:function(){return M(t)}},i("Edit")),t.translationId?d().createElement(c.Popconfirm,{title:i("Delete translation"),description:i("Are you sure you want to delete it?"),onConfirm:function(){return g(function(){return w(this,function(e){switch(e.label){case 0:if(!t.translationId)return[2];return[4,m.resource(f.MY).destroy({filterByTk:t.translationId})];case 1:return e.sent(),K(),[2]}})})()}},d().createElement(c.Button,{type:"link",size:"small"},i("Delete translation"))):null)}}],V={current:(null==_?void 0:_.page)||O.page,pageSize:(null==_?void 0:_.pageSize)||O.pageSize,total:(null==_?void 0:_.count)||0,showSizeChanger:!0,onChange:function(e,t){return j(function(n){return b(y({},n),{page:e,pageSize:t})})}};return d().createElement(c.Card,{bordered:!1},d().createElement(c.Space,{direction:"vertical",size:16,style:{width:"100%"}},d().createElement(c.Row,{justify:"space-between",align:"middle",gutter:[16,16]},d().createElement(c.Col,{flex:"auto"},d().createElement(c.Space,{wrap:!0,align:"center"},d().createElement(c.Typography,null,d().createElement(S,{strong:!0},i("Current language")),d().createElement(c.Tag,{style:{marginLeft:10}},R)),d().createElement(c.Select,{allowClear:!0,showSearch:!0,optionFilterProp:"label",placeholder:i("Module"),style:{minWidth:220},options:N,onChange:function(e){return J({module:e})}}),d().createElement(c.Input.Search,{allowClear:!0,placeholder:i("Keyword"),style:{width:220},onSearch:function(e){return J({keyword:e})}}),d().createElement(c.Radio.Group,{optionType:"button",value:O.hasTranslation,onChange:function(e){return J({hasTranslation:e.target.value})},options:[{label:i("All"),value:!0},{label:i("No translation"),value:!1}]}))),d().createElement(c.Col,null,d().createElement(c.Space,{wrap:!0,align:"center"},d().createElement(c.Popconfirm,{title:i("Delete translation"),description:i("Are you sure you want to delete it?"),onConfirm:function(){return g(function(){var e,t;return w(this,function(n){switch(n.label){case 0:if(e=new Set(I.map(function(e){return String(e)})),!(t=Y.filter(function(t){return e.has(String(t.id))}).map(function(e){return e.translationId}).filter(Boolean)).length)return c.message.error(i("Please select the records you want to delete")),[2];return[4,m.resource(f.MY).destroy({filterByTk:t})];case 1:return n.sent(),F([]),K(),[2]}})})()}},d().createElement(c.Button,{danger:!0,disabled:!I.length},i("Delete translation"))),d().createElement(c.Button,{icon:d().createElement(r.ReloadOutlined,null),loading:U,onClick:K},i("Refresh")),d().createElement(P,{sources:void 0===q?[]:q,loading:G,refresh:K}),d().createElement(c.Button,{type:"primary",icon:d().createElement(r.UploadOutlined,null),onClick:function(){return g(function(){return w(this,function(e){switch(e.label){case 0:return[4,m.resource(f.ft).publish()];case 1:return e.sent(),window.location.reload(),[2]}})})()}},i("Publish")),d().createElement(x,{selectedRowKeys:I})))),d().createElement(c.Table,{rowKey:"id",loading:U,columns:Q,dataSource:Y,pagination:V,rowSelection:{selectedRowKeys:I,onChange:F}})),d().createElement(c.Drawer,{title:i("Edit"),open:!!D,width:720,onClose:function(){return M(null)},footer:d().createElement(c.Space,{style:{display:"flex",justifyContent:"flex-end"}},d().createElement(c.Button,{onClick:function(){return M(null)}},i("Cancel")),d().createElement(c.Button,{type:"primary",onClick:function(){return g(function(){var e;return w(this,function(t){switch(t.label){case 0:return[4,v.validateFields()];case 1:if(e=t.sent(),!D)return[2];return[4,m.resource(f.MY).updateOrCreate({filterKeys:["textId","locale"],values:{textId:D.id,locale:h,translation:e.translation}})];case 2:return t.sent(),M(null),K(),[2]}})})()}},i("Submit")))},D?d().createElement(c.Space,{direction:"vertical",size:16,style:{width:"100%"}},d().createElement("div",null,d().createElement(S,{strong:!0},i("Module")),d().createElement("div",{style:{marginTop:8}},D.moduleTitle?d().createElement(c.Tag,null,C(D.moduleTitle,i)):d().createElement(c.Tag,null,D.module))),d().createElement("div",null,d().createElement(S,{strong:!0},i("Text")),d().createElement(c.Typography.Paragraph,{style:{marginTop:8}},D.text)),d().createElement(c.Form,{form:v,layout:"vertical"},d().createElement(c.Form.Item,{name:"translation",label:d().createElement(S,{strong:!0},i("Translation")),rules:[{required:!0,message:i("Translation")}]},d().createElement(c.Input.TextArea,{autoSize:{minRows:4}})))):null))}function x(e){var t,n,r,a=e.selectedRowKeys,u=(0,o.useFlowContext)(),m=p(),h=u.app.apiClient,v=(null==(t=(n=h.auth).getLocale)?void 0:t.call(n))||h.auth.locale||"en-US",y=E((0,s.useState)(null),2),b=y[0],S=y[1],C=[{mode:"incremental",title:m("Incremental translation")},{mode:"selected",title:m("Selected translation")},{mode:"full",title:m("Full translation")}];return d().createElement(i.AIEmployeeShortcut,{aiEmployee:{username:"lina"},tasks:C,size:32,mask:!1,onTaskClick:function(e){var t;return t=e.mode,g(function(){var e,n,r,o,u,s,p;return w(this,function(g){switch(g.label){case 0:if("selected"===t&&!a.length)return c.message.error(m("Please select the records you want to translate")),[2];S(t),g.label=1;case 1:return g.trys.push([1,5,6,7]),n={mode:t,locale:v,employeeUsername:"lina",textIds:"selected"===t?a:void 0},[4,h.resource(f.ft).aiTranslatePreview({values:n})];case 2:return u=(null==(o=(null==(r=g.sent())||null==(e=r.data)?void 0:e.data)||(null==r?void 0:r.data))?void 0:o.providerTitle)?l.Schema.compile(o.providerTitle,{t:m}):null==o?void 0:o.provider,s=(null==o?void 0:o.model)?(0,i.formatModelLabel)(o.model):void 0,[4,new Promise(function(e){var t;c.Modal.confirm({title:m("Confirm translation task"),content:d().createElement(c.Space,{direction:"vertical",size:8},d().createElement("div",null,m("Entries to translate"),": ",null!=(t=null==o?void 0:o.count)?t:0),d().createElement("div",null,m("Provider"),": ",u||"-"),d().createElement("div",null,m("Model"),": ",s||"-")),okText:m("Confirm"),cancelText:m("Cancel"),onOk:function(){return e(!0)},onCancel:function(){return e(!1)}})})];case 3:if(!g.sent())return[2];return[4,h.resource(f.ft).aiTranslate({values:n})];case 4:return g.sent(),c.message.success(m("Async task created")),[3,7];case 5:return p=g.sent(),c.message.error((null==p?void 0:p.message)||m("Failed to create async task")),[3,7];case 6:return S(null),[7];case 7:return[2]}})})()},loadingTaskTitle:null==(r=C.find(function(e){return e.mode===b}))?void 0:r.title,taskLoadingTitle:m("Creating...")})}function P(e){var t=e.sources,n=e.loading,l=e.refresh,a=(0,o.useFlowContext)(),i=p(),u=a.app.apiClient,m=E((0,s.useState)([]),2),h=m[0],v=m[1],y=E((0,s.useState)(!1),2),b=y[0],S=y[1],T=E((0,s.useState)(!1),2),k=T[0],O=T[1],x=(0,s.useMemo)(function(){return t.map(function(e){return e.name})},[t]);(0,s.useEffect)(function(){v(x)},[x]);var P=h.length>0&&h.length<x.length,j=x.length>0&&h.length===x.length;if(n)return null;var z=d().createElement(d().Fragment,null,d().createElement(c.Checkbox,{indeterminate:P,onChange:function(e){v(e.target.checked?x:[])},checked:j},i("All")),d().createElement(c.Divider,{style:{margin:"5px 0"}}),d().createElement(c.Checkbox.Group,{onChange:function(e){v(e)},value:h},d().createElement("div",null,t.map(function(e){return d().createElement("div",{key:e.name},d().createElement(c.Checkbox,{value:e.name},C(e.title,i)))}))),d().createElement(c.Divider,{style:{margin:"5px 0"}}),d().createElement(c.Checkbox,{checked:b,onChange:function(e){return S(e.target.checked)}},i("Reset built-in translations")));return d().createElement(c.Popover,{placement:"bottomRight",content:z},d().createElement(c.Button,{icon:d().createElement(r.SyncOutlined,null),loading:k,onClick:function(){return g(function(){return w(this,function(e){switch(e.label){case 0:if(!h.length)return[2,c.message.error(i("Please select the resources you want to synchronize"))];O(!0),e.label=1;case 1:return e.trys.push([1,,3,4]),[4,u.resource(f.ft).sync({values:{types:h,resetTranslations:b}})];case 2:return e.sent(),l(),[3,4];case 3:return O(!1),[7];case 4:return[2]}})})()}},i("Sync")))}}}]);
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare const LOCALIZATION_SETTINGS_KEY = "localization";
10
+ export declare const LOCALIZATION_ACL_SNIPPET = "pm.localization.localization";
11
+ export declare const LOCALIZATION_RESOURCE = "localization";
12
+ export declare const LOCALIZATION_TEXTS_RESOURCE = "localizationTexts";
13
+ export declare const LOCALIZATION_TRANSLATIONS_RESOURCE = "localizationTranslations";
@@ -0,0 +1,23 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { FlowEngineContext } from '@nocobase/flow-engine';
10
+ export declare class MissingKeyHandler {
11
+ private context;
12
+ static DEBOUNCE_DELAY: number;
13
+ static fallbackNS: string;
14
+ private sentMissingKeys;
15
+ private pendingMissingKeys;
16
+ private submitPendingKeysDebounced;
17
+ private missingKeyHandler;
18
+ private currentLocale?;
19
+ constructor(context: FlowEngineContext);
20
+ register(): void;
21
+ unregister(): void;
22
+ private submitPendingKeys;
23
+ }
@@ -6,5 +6,4 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import React from 'react';
10
- export declare const Localization: () => React.JSX.Element;
9
+ export { MissingKeyHandler } from './common/i18n-missing-handler';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export { default } from './plugin';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ahooks"),require("@nocobase/client-v2"),require("@nocobase/plugin-ai/client-v2"),require("react"),require("antd"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-localization/client-v2",["ahooks","@nocobase/client-v2","@nocobase/plugin-ai/client-v2","react","antd","@formily/react","@ant-design/icons","@nocobase/flow-engine","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-localization/client-v2"]=t(require("ahooks"),require("@nocobase/client-v2"),require("@nocobase/plugin-ai/client-v2"),require("react"),require("antd"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):e["@nocobase/plugin-localization/client-v2"]=t(e.ahooks,e["@nocobase/client-v2"],e["@nocobase/plugin-ai/client-v2"],e.react,e.antd,e["@formily/react"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e.lodash)}(self,function(e,t,n,r,o,i,a,c,u){return function(){"use strict";var l,s,f,p={941:function(e,t,n){n.d(t,{MY:function(){return c},Zq:function(){return o},ft:function(){return i},qQ:function(){return a},uK:function(){return r}});var r="localization",o="pm.localization.localization",i="localization",a="localizationTexts",c="localizationTranslations"},375:function(e){e.exports=a},230:function(e){e.exports=i},485:function(e){e.exports=t},694:function(e){e.exports=c},550:function(e){e.exports=n},625:function(t){t.exports=e},59:function(e){e.exports=o},773:function(e){e.exports=u},155:function(e){e.exports=r}},d={};function b(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}};return p[e](n,n.exports,b),n.exports}b.m=p,b.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return b.d(t,{a:t}),t},b.d=function(e,t){for(var n in t)b.o(t,n)&&!b.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},b.f={},b.e=function(e){return Promise.all(Object.keys(b.f).reduce(function(t,n){return b.f[n](e,t),t},[]))},b.u=function(e){return""+e+".b9d793cda3c8b932.js"},b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},h={},b.l=function(e,t,n,r){if(h[e])return void h[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/client-v2:"+n){o=u;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,b.nc&&o.setAttribute("nonce",b.nc),o.setAttribute("data-rspack","@nocobase/plugin-localization/client-v2:"+n),o.src=e),h[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=h[e];if(delete h[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)},b.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.g.importScripts&&(y=b.g.location+"");var h,y,v=b.g.document;if(!y&&v&&(v.currentScript&&"SCRIPT"===v.currentScript.tagName.toUpperCase()&&(y=v.currentScript.src),!y)){var g=v.getElementsByTagName("script");if(g.length)for(var m=g.length-1;m>-1&&(!y||!/^http(s?):/.test(y));)y=g[m--].src}if(!y)throw Error("Automatic publicPath is not supported in this browser");b.p=y.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),l={889:0},b.f.j=function(e,t){var n=b.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=b.p+b.u(e),i=Error();b.l(o,function(t){if(b.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)b.o(i,n)&&(b.m[n]=i[n]);a&&a(b)}for(e&&e(t);c<o.length;c++)r=o[c],b.o(l,r)&&l[r]&&l[r][0](),l[r]=0},(f=self.webpackChunk_nocobase_plugin_localization_client_v2=self.webpackChunk_nocobase_plugin_localization_client_v2||[]).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-v2/")}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-v2/"}b.p=e}(),!function(){b.r(w),b.d(w,{default:function(){return d}});var e=b(485),t=b(773),n=b.n(t);function r(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 o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var i=function(){var e;function t(e){var r=this;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");o(this,"context",void 0),o(this,"sentMissingKeys",void 0),o(this,"pendingMissingKeys",void 0),o(this,"submitPendingKeysDebounced",void 0),o(this,"missingKeyHandler",void 0),o(this,"currentLocale",void 0),this.context=e,this.sentMissingKeys=new Set,this.pendingMissingKeys=new Map,this.submitPendingKeysDebounced=n().debounce(function(){r.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:"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(o,i){var a=e.apply(t,n);function c(e){r(a,o,i,c,u,"next",e)}function u(e){r(a,o,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}();o(i,"DEBOUNCE_DELAY",2e3),o(i,"fallbackNS","client");var a=b(941);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)}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=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,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 n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&s(n,e),t=[{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 i(this.context).register(),this.pluginSettingsManager.addMenuItem({key:a.uK,title:this.t("Localization"),icon:"GlobalOutlined",aclSnippet:a.Zq}),this.pluginSettingsManager.addPageTabItem({menuKey:a.uK,key:"index",title:this.t("Localization"),componentLoader:function(){return b.e("796").then(b.bind(b,647))}}),[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)}}(n.prototype,t),n}(f(e.Plugin))}(),w}()});
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare const NAMESPACE: string;
10
+ export declare function tExpr(key: string): string;
11
+ export declare function useT(): (key: string) => string;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ export default function LocalizationPage(): React.JSX.Element;
11
+ export declare function LocalizationPageContent(): React.JSX.Element;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Application, Plugin } from '@nocobase/client-v2';
10
+ export declare class PluginLocalizationClientV2 extends Plugin<any, Application> {
11
+ load(): Promise<void>;
12
+ }
13
+ export default PluginLocalizationClientV2;
@@ -8,19 +8,23 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@ant-design/icons": "5.6.1",
12
- "@formily/core": "2.3.7",
13
- "@formily/react": "2.3.7",
14
- "@nocobase/client": "2.1.0-alpha.34",
15
- "ahooks": "3.7.8",
11
+ "@nocobase/client": "2.1.0-alpha.35",
16
12
  "antd": "5.24.2",
17
13
  "react": "18.2.0",
18
- "@nocobase/flow-engine": "2.1.0-alpha.34",
14
+ "@nocobase/flow-engine": "2.1.0-alpha.35",
15
+ "@nocobase/client-v2": "2.1.0-alpha.35",
16
+ "@nocobase/database": "2.1.0-alpha.35",
17
+ "@nocobase/server": "2.1.0-alpha.35",
18
+ "@nocobase/utils": "2.1.0-alpha.35",
19
+ "@nocobase/plugin-async-task-manager": "2.1.0-alpha.35",
20
+ "@nocobase/cache": "2.1.0-alpha.35",
21
+ "@nocobase/ai": "2.1.0-alpha.35",
22
+ "react-i18next": "11.18.6",
23
+ "@formily/react": "2.3.7",
19
24
  "lodash": "4.18.1",
20
- "@nocobase/database": "2.1.0-alpha.34",
21
- "@nocobase/server": "2.1.0-alpha.34",
22
- "@nocobase/utils": "2.1.0-alpha.34",
23
- "@nocobase/cache": "2.1.0-alpha.34",
24
- "@nocobase/actions": "2.1.0-alpha.34",
25
- "react-i18next": "11.18.6"
25
+ "@ant-design/icons": "5.6.1",
26
+ "@nocobase/plugin-ai": "2.1.0-alpha.35",
27
+ "ahooks": "3.7.8",
28
+ "@nocobase/actions": "2.1.0-alpha.35",
29
+ "@langchain/core": "1.1.24"
26
30
  };
@@ -1,24 +1,38 @@
1
1
  {
2
2
  "Add new": "Add new",
3
3
  "All": "All",
4
+ "Async task created": "Async task created",
4
5
  "Collections & Fields": "Collections & Fields",
6
+ "Confirm translation task": "Confirm translation task",
7
+ "Creating...": "Creating...",
5
8
  "Current language": "Current language",
6
9
  "Delete text": "Delete text",
7
10
  "Delete translation": "Delete translation",
8
11
  "Edit": "Edit",
12
+ "Entries to translate": "Entries to translate",
9
13
  "Keyword": "Keyword",
10
14
  "Localization": "Localization",
11
15
  "Localization management": "Localization management",
16
+ "Localization engineer": "Localization engineer",
12
17
  "Menu": "Menu",
18
+ "Model": "Model",
13
19
  "Module": "Module",
14
20
  "No data": "No data",
15
21
  "No translation": "No translation",
22
+ "Please select the records you want to translate": "Please select the records you want to translate",
16
23
  "Please select the resources you want to synchronize": "Please select the resources you want to synchronize",
24
+ "Provider": "Provider",
17
25
  "Publish": "Publish",
26
+ "Refresh": "Refresh",
27
+ "Reset built-in translations": "Reset built-in translations",
28
+ "Full translation": "Full translation",
29
+ "Incremental translation": "Incremental translation",
30
+ "Selected translation": "Selected translation",
18
31
  "Sync": "Sync",
19
32
  "System & Plugins": "System & Plugins",
20
33
  "Text": "Text",
34
+ "Translate localization resources with AI.": "Translate localization resources with AI.",
21
35
  "Translation": "Translation",
22
36
  "Translations": "Translations",
23
37
  "User interfaces": "User interfaces"
24
- }
38
+ }
@@ -1,24 +1,38 @@
1
1
  {
2
2
  "Add new": "新增",
3
3
  "All": "全部",
4
+ "Async task created": "异步任务已创建",
4
5
  "Collections & Fields": "数据表和字段",
6
+ "Confirm translation task": "确认翻译任务",
7
+ "Creating...": "正在创建...",
5
8
  "Current language": "当前语言",
6
9
  "Delete text": "删除原文",
7
10
  "Delete translation": "删除译文",
8
11
  "Edit": "编辑",
12
+ "Entries to translate": "即将翻译条数",
9
13
  "Keyword": "关键字",
10
14
  "Localization": "本地化",
11
15
  "Localization management": "本地化管理",
16
+ "Localization engineer": "本地化工程师",
12
17
  "Menu": "菜单",
18
+ "Model": "模型",
13
19
  "Module": "模块",
14
20
  "No data": "暂无数据",
15
21
  "No translation": "待翻译",
22
+ "Please select the records you want to translate": "请选择需要翻译的记录",
16
23
  "Please select the resources you want to synchronize": "请选择需要同步的资源",
24
+ "Provider": "服务商",
17
25
  "Publish": "发布",
26
+ "Refresh": "刷新",
27
+ "Reset built-in translations": "重置系统内置词条翻译内容",
28
+ "Full translation": "全量翻译",
29
+ "Incremental translation": "增量翻译",
30
+ "Selected translation": "翻译所选项",
18
31
  "Sync": "同步",
19
32
  "System & Plugins": "系统和插件",
20
33
  "Text": "原文",
34
+ "Translate localization resources with AI.": "使用 AI 翻译本地化资源。",
21
35
  "Translation": "译文",
22
36
  "Translations": "翻译",
23
37
  "User interfaces": "用户界面配置"
24
- }
38
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Context, Next } from '@nocobase/actions';
10
+ declare const _default: {
11
+ aiTranslate: (ctx: Context, next: Next) => Promise<void>;
12
+ aiTranslatePreview: (ctx: Context, next: Next) => Promise<void>;
13
+ };
14
+ export default _default;