@nocobase/plugin-localization 2.1.0-alpha.4 → 2.1.0-alpha.40
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/LICENSE +201 -661
- package/README.md +79 -10
- package/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/dist/ai/ai-employees/lina.d.ts +10 -0
- package/dist/ai/ai-employees/lina.js +60 -0
- package/dist/client/300.1f79b801d226f40d.js +10 -0
- package/dist/client/i18n-missing-handler.d.ts +1 -17
- package/dist/client/index.js +1 -1
- package/dist/client-v2/796.0ec484505de4b04a.js +10 -0
- package/dist/client-v2/common/constants.d.ts +13 -0
- package/dist/client-v2/common/i18n-missing-handler.d.ts +23 -0
- package/dist/{client/Localization.d.ts → client-v2/i18n-missing-handler.d.ts} +1 -2
- package/dist/client-v2/index.d.ts +9 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/client-v2/locale.d.ts +11 -0
- package/dist/client-v2/pages/LocalizationPage.d.ts +11 -0
- package/dist/client-v2/plugin.d.ts +13 -0
- package/dist/externalVersion.js +18 -13
- package/dist/locale/en-US.json +38 -1
- package/dist/locale/zh-CN.json +38 -1
- package/dist/server/actions/aiTranslate.d.ts +14 -0
- package/dist/server/actions/aiTranslate.js +151 -0
- package/dist/server/actions/localization.js +30 -15
- package/dist/server/actions/localizationTexts.js +8 -9
- package/dist/server/migrations/20260511230000-delete-official-plugin-package-resource-modules.d.ts +14 -0
- package/dist/server/migrations/20260511230000-delete-official-plugin-package-resource-modules.js +64 -0
- package/dist/server/plugin.d.ts +5 -2
- package/dist/server/plugin.js +76 -14
- package/dist/server/tasks/localization-ai-translate.d.ts +48 -0
- package/dist/server/tasks/localization-ai-translate.js +606 -0
- package/dist/server/translation-scope.d.ts +31 -0
- package/dist/server/translation-scope.js +107 -0
- package/package.json +8 -3
- package/dist/client/177bd849c95cf6cc.js +0 -10
- package/dist/server/source-manager.d.ts +0 -35
- package/dist/server/source-manager.js +0 -77
package/README.md
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
# NocoBase
|
|
2
2
|
|
|
3
3
|
<video width="100%" controls>
|
|
4
|
-
|
|
4
|
+
<source src="https://github.com/user-attachments/assets/4d11a87b-00e2-48f3-9bf7-389d21072d13" type="video/mp4">
|
|
5
5
|
</video>
|
|
6
6
|
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://trendshift.io/repositories/4112" target="_blank"><img src="https://trendshift.io/api/badge/repositories/4112" alt="nocobase%2Fnocobase | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
|
9
|
+
<a href="https://www.producthunt.com/posts/nocobase?embed=true&utm_source=badge-top-post-topic-badge&utm_medium=badge&utm_souce=badge-nocobase" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-topic-badge.svg?post_id=456520&theme=light&period=weekly&topic_id=267" alt="NocoBase - Scalability-first, open-source no-code platform | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
|
|
10
|
+
</p>
|
|
7
11
|
|
|
8
12
|
## What is NocoBase
|
|
9
13
|
|
|
10
|
-
NocoBase is
|
|
11
|
-
|
|
14
|
+
NocoBase is the most extensible AI-powered no-code platform.
|
|
15
|
+
Total control. Infinite extensibility. AI collaboration.
|
|
16
|
+
Enable your team to adapt quickly and cut costs dramatically.
|
|
17
|
+
No years of development. No millions wasted.
|
|
18
|
+
Deploy NocoBase in minutes — and take control of everything.
|
|
12
19
|
|
|
13
20
|
Homepage:
|
|
14
|
-
https://www.nocobase.com/
|
|
21
|
+
https://www.nocobase.com/
|
|
15
22
|
|
|
16
23
|
Online Demo:
|
|
17
24
|
https://demo.nocobase.com/new
|
|
@@ -19,12 +26,74 @@ https://demo.nocobase.com/new
|
|
|
19
26
|
Documents:
|
|
20
27
|
https://docs.nocobase.com/
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
https://
|
|
29
|
+
Forum:
|
|
30
|
+
https://forum.nocobase.com/
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
https://www.nocobase.com/en/
|
|
32
|
+
Use Cases:
|
|
33
|
+
https://www.nocobase.com/en/blog/tags/customer-stories
|
|
27
34
|
|
|
35
|
+
## Release Notes
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
Our [blog](https://www.nocobase.com/en/blog/timeline) is regularly updated with release notes and provides a weekly summary.
|
|
38
|
+
|
|
39
|
+
## Distinctive features
|
|
40
|
+
|
|
41
|
+
### 1. Data model-driven, not form/table–driven
|
|
42
|
+
|
|
43
|
+
Instead of being constrained by forms or tables, NocoBase adopts a data model–driven approach, separating data structure from user interface to unlock unlimited possibilities.
|
|
44
|
+
|
|
45
|
+
- UI and data structure are fully decoupled
|
|
46
|
+
- Multiple blocks and actions can be created for the same table or record in any quantity or form
|
|
47
|
+
- Supports the main database, external databases, and third-party APIs as data sources
|
|
48
|
+
|
|
49
|
+

|
|
50
|
+
|
|
51
|
+
### 2. AI employees, integrated into your business systems
|
|
52
|
+
Unlike standalone AI demos, NocoBase allows you to embed AI capabilities seamlessly into your interfaces, workflows, and data context, making AI truly useful in real business scenarios.
|
|
53
|
+
|
|
54
|
+
- Define AI employees for roles such as translator, analyst, researcher, or assistant
|
|
55
|
+
- Seamless AI–human collaboration in interfaces and workflows
|
|
56
|
+
- Ensure AI usage is secure, transparent, and customizable for your business needs
|
|
57
|
+
|
|
58
|
+

|
|
59
|
+
|
|
60
|
+
### 3. What you see is what you get, incredibly easy to use
|
|
61
|
+
|
|
62
|
+
While enabling the development of complex business systems, NocoBase keeps the experience simple and intuitive.
|
|
63
|
+
|
|
64
|
+
- One-click switch between usage mode and configuration mode
|
|
65
|
+
- Pages serve as a canvas to arrange blocks and actions, similar to Notion
|
|
66
|
+
- Configuration mode is designed for ordinary users, not just programmers
|
|
67
|
+
|
|
68
|
+

|
|
69
|
+
|
|
70
|
+
### 4. Everything is a plugin, designed for extension
|
|
71
|
+
Adding more no-code features will never cover every business case. NocoBase is built for extension through its plugin-based microkernel architecture.
|
|
72
|
+
|
|
73
|
+
- All functionalities are plugins, similar to WordPress
|
|
74
|
+
- Plugins are ready to use upon installation
|
|
75
|
+
- Pages, blocks, actions, APIs, and data sources can all be extended through custom plugins
|
|
76
|
+
|
|
77
|
+

|
|
78
|
+
|
|
79
|
+
## Installation
|
|
80
|
+
|
|
81
|
+
NocoBase supports three installation methods:
|
|
82
|
+
|
|
83
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/docker-compose">Installing With Docker (👍Recommended)</a>
|
|
84
|
+
|
|
85
|
+
Suitable for no-code scenarios, no code to write. When upgrading, just download the latest image and reboot.
|
|
86
|
+
|
|
87
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/create-nocobase-app">Installing from create-nocobase-app CLI</a>
|
|
88
|
+
|
|
89
|
+
The business code of the project is completely independent and supports low-code development.
|
|
90
|
+
|
|
91
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/git-clone">Installing from Git source code</a>
|
|
92
|
+
|
|
93
|
+
If you want to experience the latest unreleased version, or want to participate in the contribution, you need to make changes and debug on the source code, it is recommended to choose this installation method, which requires a high level of development skills, and if the code has been updated, you can git pull the latest code.
|
|
94
|
+
|
|
95
|
+
## How NocoBase works
|
|
96
|
+
|
|
97
|
+
<video width="100%" controls>
|
|
98
|
+
<source src="https://github.com/user-attachments/assets/8d183b44-9bb5-4792-b08f-bc08fe8dfaaf" type="video/mp4">
|
|
99
|
+
</video>
|
package/client-v2.d.ts
ADDED
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: "raw",
|
|
44
|
+
enableSkills: false,
|
|
45
|
+
enableTools: false
|
|
46
|
+
},
|
|
47
|
+
systemPrompt: `# Role
|
|
48
|
+
You are Lina, a professional localization translator for NocoBase.
|
|
49
|
+
|
|
50
|
+
# Task
|
|
51
|
+
Translate NocoBase localization text into the requested target language.
|
|
52
|
+
|
|
53
|
+
# Translation requirements
|
|
54
|
+
1. Keep the translation faithful, concise, and natural for product UI.
|
|
55
|
+
2. Use consistent NocoBase and software terminology.
|
|
56
|
+
3. Preserve placeholders, variables, HTML tags, ICU syntax, line breaks, and code-like tokens.
|
|
57
|
+
4. Return only the translated text. Do not explain, quote, or use Markdown.
|
|
58
|
+
5. If the text should not be translated, return it unchanged.
|
|
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 I},LocalizationPageContent:function(){return F}});var r=n(375),l=n(477),a=n(230),o=n(485),i=n(694),c=n(550),u=n(625),s=n(59),m=n(155),d=n.n(m),f="localization",p="localizationTranslations",g=JSON.parse('{"UU":"@nocobase/plugin-localization"}').UU;function h(){var e=(0,i.useFlowEngine)();return function(t){return e.context.t(t,{ns:[g,"client"]})}}function v(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),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,l)}function b(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 E(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 w(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 S(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 v(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 v(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 C(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:c(0)}),i(o,"throw",{value:c(1)}),i(o,"return",{value:c(2)}),"function"==typeof Symbol&&i(o,Symbol.iterator,{value:function(){return this}}),o;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&u[0]?r.return:u[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,u[1])).done)return l;switch(r=0,l&&(u=[2&u[0],l.value]),u[0]){case 0:case 1:l=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(l=(l=a.trys).length>0&&l[l.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!l||u[1]>l[0]&&u[1]<l[3])){a.label=u[1];break}if(6===u[0]&&a.label<l[1]){a.label=l[1],l=u;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(u);break}l[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=l=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function k(){var e,t,n=(e=["\n .editable-cell {\n position: relative;\n }\n\n .editable-cell-value-wrap {\n min-height: 32px;\n padding: 5px 12px;\n cursor: pointer;\n }\n\n &:hover .editable-cell-value-wrap {\n border: 1px solid #d9d9d9;\n border-radius: 4px;\n padding: 4px 11px;\n }\n\n [data-theme='dark'] &:hover .editable-cell-value-wrap {\n border: 1px solid #434343;\n }\n"],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return k=function(){return n},n}var T=s.Typography.Text,O=(0,l.css)(k());function P(e){var t,n=e.api,r=e.t,l=e.task,o=e.values,i=e.languageOptions,u=e.onChange,p=e.onPreviewChange,g=S((0,m.useState)(o.scope||"all"),2),h=g[0],v=g[1],y=S((0,m.useState)(o.referenceLocales),2),b=y[0],C=y[1],k=S((0,m.useState)(),2),O=k[0],P=k[1],x=S((0,m.useState)(!1),2),j=x[0],I=x[1],F="selected"===l.mode,z=(0,m.useMemo)(function(){return[{label:r("All"),value:"all"},{label:r("Built-in entries"),value:"builtIn"},{label:r("Custom entries"),value:"custom"}]},[r]),R=!F&&"custom"!==h,L=!F&&"builtIn"!==h,B=function(e){return d().createElement("span",{style:{fontWeight:400}},e)};(0,m.useEffect)(function(){u({scope:h,referenceLocales:b})},[u,b,h]),(0,m.useEffect)(function(){var e=!1,t=w(E({},o),{scope:h});return I(!0),p({count:0,loading:!0}),n.resource(f).aiTranslatePreview({values:t}).then(function(t){if(!e){var n,r,l=(null==t||null==(r=t.data)?void 0:r.data)||(null==t?void 0:t.data);P(l),p({count:null!=(n=null==l?void 0:l.count)?n:0,loading:!1})}}).catch(function(t){e||s.message.error((null==t?void 0:t.message)||r("Failed to create async task"))}).finally(function(){e||I(!1)}),function(){e=!0}},[n,p,h,r,o]);var D=(null==O?void 0:O.providerTitle)?a.Schema.compile(O.providerTitle,{t:r}):null==O?void 0:O.provider,A=(null==O?void 0:O.model)?(0,c.formatModelLabel)(O.model):void 0;return d().createElement(s.Space,{direction:"vertical",size:12,style:{width:"100%"}},d().createElement(s.Typography.Paragraph,{style:{marginBottom:0}},l.description),F?null:d().createElement("div",null,d().createElement(T,{strong:!0},r("Translation scope")),d().createElement("div",{style:{marginTop:8}},d().createElement(s.Radio.Group,{value:h,options:z,onChange:function(e){return v(e.target.value)}})),d().createElement(s.Typography.Paragraph,{type:"secondary",style:{marginTop:8,marginBottom:0}},r("Built-in entries are system and plugin entries. Custom entries include route names, collection and field names, and UI content."))),d().createElement("div",null,d().createElement(T,{strong:!0},r("Entries to translate")),": ",j?r("Loading..."):null!=(t=null==O?void 0:O.count)?t:0),d().createElement("div",null,d().createElement(T,{strong:!0},r("Provider")),": ",D||"-"),d().createElement("div",null,d().createElement(T,{strong:!0},r("Model")),": ",A||"-"),d().createElement(s.Form,{layout:"vertical",initialValues:{referenceLocales:F?w(E({},b),{common:b.custom}):b},onValuesChange:function(e,t){var n=t.referenceLocales;if(F&&(null==n?void 0:n.common))C({builtIn:n.common,custom:n.common});else{var r=n||{};C((r.common,function(e,t){if(null==e)return{};var n,r,l,a={};if("u">typeof Reflect&&Reflect.ownKeys){for(l=0,n=Reflect.ownKeys(Object(e));l<n.length;l++)r=n[l],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}if(a=function(e,t){if(null==e)return{};var n,r,l={},a=Object.getOwnPropertyNames(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}(e,t),Object.getOwnPropertySymbols)for(l=0,n=Object.getOwnPropertySymbols(e);l<n.length;l++)r=n[l],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}(r,["common"])))}}},F?d().createElement("div",null,d().createElement(T,{strong:!0},r("Reference translation")),d().createElement(s.Row,{gutter:12},d().createElement(s.Col,{span:12},d().createElement(s.Form.Item,{name:["referenceLocales","common","primary"],label:B(r("Default language"))},d().createElement(s.Select,{showSearch:!0,optionFilterProp:"label",options:i}))),d().createElement(s.Col,{span:12},d().createElement(s.Form.Item,{name:["referenceLocales","common","fallback"],label:B(r("Fallback language"))},d().createElement(s.Select,{showSearch:!0,optionFilterProp:"label",options:i}))))):null,R?d().createElement("div",null,d().createElement(T,{strong:!0},r("Built-in entries reference translation")),d().createElement(s.Row,{gutter:12},d().createElement(s.Col,{span:12},d().createElement(s.Form.Item,{name:["referenceLocales","builtIn","primary"],label:B(r("Default language"))},d().createElement(s.Select,{showSearch:!0,optionFilterProp:"label",options:i}))),d().createElement(s.Col,{span:12},d().createElement(s.Form.Item,{name:["referenceLocales","builtIn","fallback"],label:B(r("Fallback language"))},d().createElement(s.Select,{showSearch:!0,optionFilterProp:"label",options:i}))))):null,L?d().createElement("div",null,d().createElement(T,{strong:!0},r("Custom entries reference translation")),d().createElement(s.Row,{gutter:12},d().createElement(s.Col,{span:12},d().createElement(s.Form.Item,{name:["referenceLocales","custom","primary"],label:B(r("Default language"))},d().createElement(s.Select,{showSearch:!0,optionFilterProp:"label",options:i}))),d().createElement(s.Col,{span:12},d().createElement(s.Form.Item,{name:["referenceLocales","custom","fallback"],label:B(r("Fallback language"))},d().createElement(s.Select,{showSearch:!0,optionFilterProp:"label",options:i}))))):null))}function x(e,t){return a.Schema.compile(e,{t:t})}var j=function(e){var t=e.value,n=e.record,r=e.onSave,l=S((0,m.useState)(!1),2),a=l[0],o=l[1],i=S((0,m.useState)(t||""),2),c=i[0],u=i[1],f=S((0,m.useState)(!1),2),p=f[0],g=f[1],h=(0,m.useRef)(null),v=(0,m.useRef)(!1);(0,m.useEffect)(function(){u(t||"")},[t]),(0,m.useEffect)(function(){if(a){var e,t;null==(t=h.current)||null==(e=t.focus)||e.call(t)}},[a]);var y=function(){v.current=!0,u(t||""),o(!1)};return a?d().createElement(s.Input,{ref:h,value:c,disabled:p,onBlur:function(){return b(function(){return C(this,function(e){switch(e.label){case 0:if(v.current)return v.current=!1,[2];if(c===(t||""))return o(!1),[2];g(!0),e.label=1;case 1:return e.trys.push([1,,3,4]),[4,r(n,c)];case 2:return e.sent(),o(!1),[3,4];case 3:return g(!1),[7];case 4:return[2]}})})()},onChange:function(e){return u(e.target.value)},onPressEnter:function(e){return e.currentTarget.blur()},onKeyDown:function(e){"Escape"===e.key&&y()}}):d().createElement("div",{className:"editable-cell"},d().createElement("div",{className:"editable-cell-value-wrap",onClick:function(){v.current=!1,u(t||""),o(!0)}},t))};function I(){return d().createElement(F,null)}function F(){var e,t,n,l=(0,i.useFlowContext)(),a=h(),c=l.app.apiClient,g=(null==(e=(t=c.auth).getLocale)?void 0:e.call(t))||c.auth.locale||"en-US",v=S(s.Form.useForm(),1)[0],y=S((0,m.useState)({page:1,pageSize:50,hasTranslation:!0}),2),k=y[0],P=y[1],I=S((0,m.useState)([]),2),F=I[0],L=I[1],B=S((0,m.useState)(null),2),D=B[0],A=B[1],M=(null==(n=o.languageCodes[g])?void 0:n.label)||g,U=(0,u.useRequest)(function(){return b(function(){return C(this,function(e){switch(e.label){case 0:return[4,c.resource("localizationTexts").list(w(E({},k),{hasTranslation:String(k.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:[k]}),K=U.data,N=U.loading,_=U.refresh,G=(0,u.useRequest)(function(){return b(function(){var e,t;return C(this,function(n){switch(n.label){case 0:return[4,c.resource(f).getSources()];case 1:return[2,(null==(t=n.sent())||null==(e=t.data)?void 0:e.data)||[]]}})})()}),q=G.data,V=G.loading,J=(null==K?void 0:K.rows)||[],W=(0,m.useMemo)(function(){return((null==K?void 0:K.modules)||[]).map(function(e){return{value:e.value,label:x(e.label,a)}})},[null==K?void 0:K.modules,a]);(0,m.useEffect)(function(){D?v.setFieldsValue({translation:D.translation}):v.resetFields()},[D,v]);var $=function(e){P(function(t){return w(E({},t,e),{page:1})})},H=function(e,t){return b(function(){var n;return C(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,c.resource(p).updateOrCreate({filterKeys:["textId","locale"],values:{textId:e.id,locale:g,translation:t}})];case 1:return r.sent(),_(),[3,3];case 2:return n=r.sent(),s.message.error((null==n?void 0:n.message)||a("Failed to save translation")),[3,3];case 3:return[2]}})})()},Q=[{title:a("Text"),dataIndex:"text",ellipsis:!0},{title:a("Translation"),dataIndex:"translation",ellipsis:!0,render:function(e,t){return d().createElement(j,{value:e,record:t,onSave:H})}},{title:a("Module"),dataIndex:"moduleTitle",width:220,render:function(e,t){return t.moduleTitle?d().createElement(s.Tag,null,x(t.moduleTitle,a)):d().createElement(s.Tag,null,t.module)}},{title:a("Actions"),key:"actions",width:240,render:function(e,t){return d().createElement(s.Space,{split:d().createElement(s.Divider,{type:"vertical"}),style:{whiteSpace:"nowrap"}},d().createElement(s.Button,{type:"link",size:"small",onClick:function(){return A(t)}},a("Edit")),t.translationId?d().createElement(s.Popconfirm,{title:a("Delete translation"),description:a("Are you sure you want to delete it?"),onConfirm:function(){return b(function(){return C(this,function(e){switch(e.label){case 0:if(!t.translationId)return[2];return[4,c.resource(p).destroy({filterByTk:t.translationId})];case 1:return e.sent(),_(),[2]}})})()}},d().createElement(s.Button,{type:"link",size:"small"},a("Delete translation"))):null)}}],X={current:(null==K?void 0:K.page)||k.page,pageSize:(null==K?void 0:K.pageSize)||k.pageSize,total:(null==K?void 0:K.count)||0,showSizeChanger:!0,onChange:function(e,t){return P(function(n){return w(E({},n),{page:e,pageSize:t})})}};return d().createElement(s.Card,{bordered:!1},d().createElement(s.Space,{direction:"vertical",size:16,style:{width:"100%"}},d().createElement(s.Row,{justify:"space-between",align:"middle",gutter:[16,16]},d().createElement(s.Col,{flex:"auto"},d().createElement(s.Space,{wrap:!0,align:"center"},d().createElement(s.Typography,null,d().createElement(T,{strong:!0},a("Current language")),d().createElement(s.Tag,{style:{marginLeft:10}},M)),d().createElement(s.Select,{allowClear:!0,showSearch:!0,optionFilterProp:"label",placeholder:a("Module"),style:{minWidth:220},options:W,onChange:function(e){return $({module:e})}}),d().createElement(s.Input.Search,{allowClear:!0,placeholder:a("Keyword"),style:{width:220},onSearch:function(e){return $({keyword:e})}}),d().createElement(s.Radio.Group,{optionType:"button",value:k.hasTranslation,onChange:function(e){return $({hasTranslation:e.target.value})},options:[{label:a("All"),value:!0},{label:a("No translation"),value:!1}]}))),d().createElement(s.Col,null,d().createElement(s.Space,{wrap:!0,align:"center"},d().createElement(s.Popconfirm,{title:a("Delete translation"),description:a("Are you sure you want to delete it?"),onConfirm:function(){return b(function(){var e,t;return C(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 s.message.error(a("Please select the records you want to delete")),[2];return[4,c.resource(p).destroy({filterByTk:t})];case 1:return n.sent(),L([]),_(),[2]}})})()}},d().createElement(s.Button,{danger:!0,disabled:!F.length},a("Delete translation"))),d().createElement(s.Button,{icon:d().createElement(r.ReloadOutlined,null),loading:N,onClick:_},a("Refresh")),d().createElement(R,{sources:void 0===q?[]:q,loading:V,refresh:_}),d().createElement(s.Button,{type:"primary",icon:d().createElement(r.UploadOutlined,null),onClick:function(){return b(function(){return C(this,function(e){switch(e.label){case 0:return[4,c.resource(f).publish()];case 1:return e.sent(),window.location.reload(),[2]}})})()}},a("Publish")),d().createElement(z,{selectedRowKeys:F})))),d().createElement(s.Table,{rowKey:"id",loading:N,columns:Q,dataSource:J,pagination:X,rowClassName:O,rowSelection:{selectedRowKeys:F,onChange:L}})),d().createElement(s.Drawer,{title:a("Edit"),open:!!D,width:720,onClose:function(){return A(null)},footer:d().createElement(s.Space,{style:{display:"flex",justifyContent:"flex-end"}},d().createElement(s.Button,{onClick:function(){return A(null)}},a("Cancel")),d().createElement(s.Button,{type:"primary",onClick:function(){return b(function(){var e;return C(this,function(t){switch(t.label){case 0:return[4,v.validateFields()];case 1:if(e=t.sent(),!D)return[2];return[4,H(D,e.translation)];case 2:return t.sent(),A(null),[2]}})})()}},a("Submit")))},D?d().createElement(s.Space,{direction:"vertical",size:16,style:{width:"100%"}},d().createElement("div",null,d().createElement(T,{strong:!0},a("Module")),d().createElement("div",{style:{marginTop:8}},D.moduleTitle?d().createElement(s.Tag,null,x(D.moduleTitle,a)):d().createElement(s.Tag,null,D.module))),d().createElement("div",null,d().createElement(T,{strong:!0},a("Text")),d().createElement(s.Typography.Paragraph,{style:{marginTop:8}},D.text)),d().createElement(s.Form,{form:v,layout:"vertical"},d().createElement(s.Form.Item,{name:"translation",label:d().createElement(T,{strong:!0},a("Translation")),rules:[{required:!0,message:a("Translation")}]},d().createElement(s.Input.TextArea,{autoSize:{minRows:4}})))):null))}function z(e){var t,n,r,l,a,u,p=e.selectedRowKeys,g=(0,i.useFlowContext)(),v=h(),y=g.app.apiClient,k=(null==(t=(n=y.auth).getLocale)?void 0:t.call(n))||y.auth.locale||"en-US",T=null==(u=g.systemSettings)||null==(a=u.data)||null==(l=a.data)||null==(r=l.enabledLanguages)?void 0:r[0],O=S((0,m.useState)(),2),x=O[0],j=O[1],I=(0,m.useMemo)(function(){return Object.entries(o.languageCodes).map(function(e){var t=S(e,2),n=t[0];return{value:n,label:t[1].label||n}})},[]),F=(0,m.useMemo)(function(){return{builtIn:{primary:"zh-CN",fallback:"ja-JP"},custom:{primary:T||"en-US",fallback:"zh-CN"}}},[T]),z=[{mode:"incremental",title:v("Incremental translation"),description:v("Translate entries that do not yet have a translation in the current language.")},{mode:"selected",title:v("Selected translation"),description:v("Translate only the selected entries in the table.")},{mode:"full",title:v("Full translation"),description:v("Translate all entries in the current language, including existing translations.")}];return d().createElement(c.AIEmployeeShortcut,{aiEmployee:{username:"lina"},tasks:z,size:32,mask:!1,onTaskClick:function(e){return b(function(){var t,n,r,l,a,o,i,c,u,m,h;return C(this,function(b){switch(b.label){case 0:if("selected"===(t=e.mode)&&!p.length)return s.message.error(v("Please select the records you want to translate")),[2];j(e.title),b.label=1;case 1:return b.trys.push([1,5,6,7]),[4,null==(r=g.systemSettings)||null==(n=r.load)?void 0:n.call(r)];case 2:return i=(null==(o=b.sent())||null==(a=o.data)||null==(l=a.enabledLanguages)?void 0:l[0])||F.custom.primary,c=w(E({},F),{custom:w(E({},F.custom),{primary:i})}),u={mode:t,scope:"all",locale:k,employeeUsername:"lina",referenceLocales:c,textIds:"selected"===t?p:void 0},m={count:0,loading:!0},[4,new Promise(function(t){s.Modal.confirm({title:e.title,width:640,content:d().createElement(P,{api:y,t:v,task:e,values:u,languageOptions:I,onChange:function(e){Object.assign(u,e)},onPreviewChange:function(e){Object.assign(m,e)}}),okText:v("Confirm"),cancelText:v("Cancel"),onOk:function(){return m.loading?(s.message.warning(v("Please wait for the translation preview to load")),Promise.reject()):m.count<=0?(s.message.warning(v("No entries to translate")),Promise.reject()):void t(!0)},onCancel:function(){return t(!1)}})})];case 3:if(!b.sent())return[2];return[4,y.resource(f).aiTranslate({values:u})];case 4:return b.sent(),s.message.success(v("Async task created")),[3,7];case 5:return h=b.sent(),s.message.error((null==h?void 0:h.message)||v("Failed to create async task")),[3,7];case 6:return j(void 0),[7];case 7:return[2]}})})()},loadingTaskTitle:x,taskLoadingTitle:v("Creating...")})}function R(e){var t=e.sources,n=e.loading,l=e.refresh,a=(0,i.useFlowContext)(),o=h(),c=a.app.apiClient,u=S((0,m.useState)([]),2),p=u[0],g=u[1],v=S((0,m.useState)(!1),2),y=v[0],E=v[1],w=S((0,m.useState)(!1),2),k=w[0],T=w[1],O=(0,m.useMemo)(function(){return t.map(function(e){return e.name})},[t]);(0,m.useEffect)(function(){g(O)},[O]);var P=p.length>0&&p.length<O.length,j=O.length>0&&p.length===O.length;if(n)return null;var I=d().createElement(d().Fragment,null,d().createElement(s.Checkbox,{indeterminate:P,onChange:function(e){g(e.target.checked?O:[])},checked:j},o("All")),d().createElement(s.Divider,{style:{margin:"5px 0"}}),d().createElement(s.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(s.Checkbox,{value:e.name},x(e.title,o)))}))),d().createElement(s.Divider,{style:{margin:"5px 0"}}),d().createElement(s.Checkbox,{checked:y,onChange:function(e){return E(e.target.checked)}},o("Reset built-in translations")));return d().createElement(s.Popover,{placement:"bottomRight",content:I},d().createElement(s.Button,{icon:d().createElement(r.SyncOutlined,null),loading:k,onClick:function(){return b(function(){return C(this,function(e){switch(e.label){case 0:if(!p.length)return[2,s.message.error(o("Please select the resources you want to synchronize"))];T(!0),e.label=1;case 1:return e.trys.push([1,,3,4]),[4,c.resource(f).sync({values:{types:p,resetTranslations:y}})];case 2:return e.sent(),l(),[3,4];case 3:return T(!1),[7];case 4:return[2]}})})()}},o("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
|
-
|
|
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';
|
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,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("@formily/core"),require("ahooks"),require("@nocobase/client"),require("react"),require("@formily/react"),require("lodash"),require("@ant-design/icons"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-localization",["@formily/core","ahooks","@nocobase/client","react","@formily/react","lodash","@ant-design/icons","antd","react-i18next"],n):"object"==typeof exports?exports["@nocobase/plugin-localization"]=n(require("@formily/core"),require("ahooks"),require("@nocobase/client"),require("react"),require("@formily/react"),require("lodash"),require("@ant-design/icons"),require("antd"),require("react-i18next")):e["@nocobase/plugin-localization"]=n(e["@formily/core"],e.ahooks,e["@nocobase/client"],e.react,e["@formily/react"],e.lodash,e["@ant-design/icons"],e.antd,e["react-i18next"])}(self,function(e,n,t,r,i,o,a,u,c){return function(){var s,l,f,p,d,y,b={551:function(e,n,t){"use strict";t.d(n,{A:function(){return i},F:function(){return o}});var r=t(238),i="localization",o=function(){return(0,r.useTranslation)([i,"client"],{nsMode:"fallback"})}},581:function(e){e.exports=function(e,n){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,n),n}},482:function(e){"use strict";e.exports=a},563:function(n){"use strict";n.exports=e},505:function(e){"use strict";e.exports=i},772:function(e){"use strict";e.exports=t},749:function(e){"use strict";e.exports=n},721:function(e){"use strict";e.exports=u},467:function(e){"use strict";e.exports=o},156:function(e){"use strict";e.exports=r},238:function(e){"use strict";e.exports=c}},h={};function v(e){var n=h[e];if(void 0!==n)return n.exports;var t=h[e]={exports:{}};return b[e](t,t.exports,v),t.exports}v.m=b,v.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return v.d(n,{a:n}),n},v.d=function(e,n){for(var t in n)v.o(n,t)&&!v.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},v.f={},v.e=function(e){return Promise.all(Object.keys(v.f).reduce(function(n,t){return v.f[t](e,n),n},[]))},v.u=function(e){return"177bd849c95cf6cc.js"},v.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),v.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},s={},l="@nocobase/plugin-localization:",v.l=function(e,n,t,r){if(s[e])return void s[e].push(n);if(void 0!==t)for(var i,o,a=document.getElementsByTagName("script"),u=0;u<a.length;u++){var c=a[u];if(c.getAttribute("src")==e||c.getAttribute("data-webpack")==l+t){i=c;break}}i||(o=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,v.nc&&i.setAttribute("nonce",v.nc),i.setAttribute("data-webpack",l+t),i.src=e),s[e]=[n];var f=function(n,t){i.onerror=i.onload=null,clearTimeout(p);var r=s[e];if(delete s[e],i.parentNode&&i.parentNode.removeChild(i),r&&r.forEach(function(e){return e(t)}),n)return n(t)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=f.bind(null,i.onerror),i.onload=f.bind(null,i.onload),o&&document.head.appendChild(i)},v.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(f=window.__webpack_public_path__||"/").endsWith("/")||(f+="/"),v.p=f+"static/plugins/@nocobase/plugin-localization/dist/client/",p={909:0},v.f.j=function(e,n){var t=v.o(p,e)?p[e]:void 0;if(0!==t)if(t)n.push(t[2]);else{var r=new Promise(function(n,r){t=p[e]=[n,r]});n.push(t[2]=r);var i=v.p+v.u(e),o=Error();v.l(i,function(n){if(v.o(p,e)&&(0!==(t=p[e])&&(p[e]=void 0),t)){var r=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;o.message="Loading chunk "+e+" failed.\n("+r+": "+i+")",o.name="ChunkLoadError",o.type=r,o.request=i,t[1](o)}},"chunk-"+e,e)}},d=function(e,n){var t,r,i=n[0],o=n[1],a=n[2],u=0;if(i.some(function(e){return 0!==p[e]})){for(t in o)v.o(o,t)&&(v.m[t]=o[t]);a&&a(v)}for(e&&e(n);u<i.length;u++)r=i[u],v.o(p,r)&&p[r]&&p[r][0](),p[r]=0},(y=self.webpackChunk_nocobase_plugin_localization=self.webpackChunk_nocobase_plugin_localization||[]).forEach(d.bind(null,0)),y.push=d.bind(null,y.push.bind(y));var g={};return!function(){"use strict";v.r(g),v.d(g,{PluginLocalizationClient:function(){return b},default:function(){return h}});var e=v(772),n=v(551),t=v(467),r=v.n(t);function i(e,n,t,r,i,o,a){try{var u=e[o](a),c=u.value}catch(e){t(e);return}u.done?n(c):Promise.resolve(c).then(r,i)}function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var a=function(){var e;function n(e){var t=this;if(!(this instanceof n))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=r().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.flowSettingsEnabled&&"client"!==t&&"ui-schema-storage"!==t){var i,o="".concat(t,":").concat(r);if(!(!r||e.sentMissingKeys.has(o)))try{e.currentLocale=null==(i=e.context.i18n)?void 0:i.language,e.sentMissingKeys.add(o),e.pendingMissingKeys.set(o,{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:"isFallbackClient",value:function(e,t){if(e!==n.fallbackNS)return!1;var r=!0,i=!1,o=void 0;try{for(var a,u=this.pendingMissingKeys.values()[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var c=a.value;if(c.key===t&&c.ns!==n.fallbackNS)return!0}}catch(e){i=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(i)throw o}}var s=!0,l=!1,f=void 0;try{for(var p,d=this.sentMissingKeys[Symbol.iterator]();!(s=(p=d.next()).done);s=!0){var y=p.value,b=y.indexOf(":");if(b>-1){var h=y.slice(0,b);if(y.slice(b+1)===t&&h!==n.fallbackNS)return!0}}}catch(e){l=!0,f=e}finally{try{s||null==d.return||d.return()}finally{if(l)throw f}}return!1}},{key:"removeClientFallback",value:function(e){e&&this.pendingMissingKeys.delete("".concat(n.fallbackNS,":").concat(e))}},{key:"submitPendingKeys",value:function(){var e,n=this;return(e=function(){var e;return function(e,n){var t,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){var c=[o,u];if(t)throw TypeError("Generator is already executing.");for(;a;)try{if(t=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=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(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(6===c[0]&&a.label<i[1]){a.label=i[1],i=c;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(c);break}i[2]&&a.ops.pop(),a.trys.pop();continue}c=n.call(e,a)}catch(e){c=[6,e],r=0}finally{t=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:if(0===n.pendingMissingKeys.size)return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),e=Array.from(n.pendingMissingKeys.values()).map(function(e){return{text:e.key,ns:e.ns}}),[4,n.context.api.request({method:"POST",url:"/localizationTexts:missing",data:{keys:e,locale:n.currentLocale}})];case 2:return t.sent(),n.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 n=this,t=arguments;return new Promise(function(r,o){var a=e.apply(n,t);function u(e){i(a,r,o,u,c,"next",e)}function c(e){i(a,r,o,u,c,"throw",e)}u(void 0)})})()}}],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}();o(a,"DEBOUNCE_DELAY",2e3),o(a,"fallbackNS","client");var u=v(581);function c(e,n,t,r,i,o,a){try{var u=e[o](a),c=u.value}catch(e){t(e);return}u.done?n(c):Promise.resolve(c).then(r,i)}function s(e,n,t){return(s=d()?Reflect.construct:function(e,n,t){var r=[null];r.push.apply(r,n);var i=new(Function.bind.apply(e,r));return t&&f(i,t.prototype),i}).apply(null,arguments)}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,n){return(f=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e})(e,n)}function p(e){var n="function"==typeof Map?new Map:void 0;return(p=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 s(e,arguments,l(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),f(t,e)})(e)}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}var y=(0,e.lazy)(function(){return u("imported_-237jod_component",v.e("121").then(v.bind(v,730)))},"Localization").Localization,b=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,n=arguments,e=l(e),function(e,n){var t;if(n&&("object"==((t=n)&&"undefined"!=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,d()?Reflect.construct(e,n||[],l(this).constructor):e.apply(this,n))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&f(r,e),t=[{key:"load",value:function(){var e,t=this;return(e=function(){return function(e,n){var t,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){var c=[o,u];if(t)throw TypeError("Generator is already executing.");for(;a;)try{if(t=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=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(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(6===c[0]&&a.label<i[1]){a.label=i[1],i=c;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(c);break}i[2]&&a.ops.pop(),a.trys.pop();continue}c=n.call(e,a)}catch(e){c=[6,e],r=0}finally{t=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(e){return new a(t.engine.context).register(),t.app.pluginSettingsManager.add(n.A,{title:'{{t("Localization", { ns: "'.concat(n.A,'" })}}'),icon:"GlobalOutlined",Component:y,aclSnippet:"pm.localization.localization"}),[2]})},function(){var n=this,t=arguments;return new Promise(function(r,i){var o=e.apply(n,t);function a(e){c(o,r,i,a,u,"next",e)}function u(e){c(o,r,i,a,u,"throw",e)}a(void 0)})})()}}],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)}}(r.prototype,t),r}(p(e.Plugin)),h=b}(),g}()});
|
|
10
|
+
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("ahooks"),require("react-i18next"),require("@emotion/css"),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","@emotion/css","@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("@emotion/css"),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["@emotion/css"],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,s,l,f){return function(){"use strict";var p,d,b,h={375:function(e){e.exports=s},477:function(e){e.exports=t},230:function(e){e.exports=u},342:function(e){e.exports=c},485:function(e){e.exports=r},694:function(e){e.exports=l},550:function(e){e.exports=o},625:function(n){n.exports=e},59:function(e){e.exports=a},773:function(e){e.exports=f},155:function(e){e.exports=i},953:function(e){e.exports=n}},y={};function v(e){var n=y[e];if(void 0!==n)return n.exports;var t=y[e]={exports:{}};return h[e](t,t.exports,v),t.exports}v.m=h,v.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return v.d(n,{a:n}),n},v.d=function(e,n){for(var t in n)v.o(n,t)&&!v.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},v.f={},v.e=function(e){return Promise.all(Object.keys(v.f).reduce(function(n,t){return v.f[t](e,n),n},[]))},v.u=function(e){return""+e+".1f79b801d226f40d.js"},v.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),v.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},g={},v.l=function(e,n,t,r){if(g[e])return void g[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,v.nc&&o.setAttribute("nonce",v.nc),o.setAttribute("data-rspack","@nocobase/plugin-localization:"+t),o.src=e),g[e]=[n];var s=function(n,t){o.onerror=o.onload=null,clearTimeout(l);var r=g[e];if(delete g[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(t)}),n)return n(t)},l=setTimeout(s.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=s.bind(null,o.onerror),o.onload=s.bind(null,o.onload),i&&document.head.appendChild(o)},v.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},v.g.importScripts&&(m=v.g.location+"");var g,m,w=v.g.document;if(!m&&w&&(w.currentScript&&"SCRIPT"===w.currentScript.tagName.toUpperCase()&&(m=w.currentScript.src),!m)){var x=w.getElementsByTagName("script");if(x.length)for(var k=x.length-1;k>-1&&(!m||!/^http(s?):/.test(m));)m=x[k--].src}if(!m)throw Error("Automatic publicPath is not supported in this browser");v.p=m.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),p={889:0},v.f.j=function(e,n){var t=v.o(p,e)?p[e]:void 0;if(0!==t)if(t)n.push(t[2]);else{var r=new Promise(function(n,r){t=p[e]=[n,r]});n.push(t[2]=r);var o=v.p+v.u(e),i=Error();v.l(o,function(n){if(v.o(p,e)&&(0!==(t=p[e])&&(p[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)}},d=function(e,n){var t,r,o=n[0],i=n[1],a=n[2],c=0;if(o.some(function(e){return 0!==p[e]})){for(t in i)v.o(i,t)&&(v.m[t]=i[t]);a&&a(v)}for(e&&e(n);c<o.length;c++)r=o[c],v.o(p,r)&&p[r]&&p[r][0](),p[r]=0},(b=self.webpackChunk_nocobase_plugin_localization=self.webpackChunk_nocobase_plugin_localization||[]).forEach(d.bind(null,0)),b.push=d.bind(null,b.push.bind(b));var O={};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/"}v.p=e}(),!function(){v.r(O),v.d(O,{PluginLocalizationClient:function(){return m},default:function(){return w}});var e=v(342),n=v(59),t=v(155),r=v.n(t);v(953);var o="localization",i=v(773),a=v.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 s=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 s=[c,u];if(t)throw TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=n.call(e,i)}catch(e){s=[6,e],r=0}finally{t=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[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 l(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&&d(o,t.prototype),o}).apply(null,arguments)}u(s,"DEBOUNCE_DELAY",2e3),u(s,"fallbackNS","client");function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,n){return(d=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e})(e,n)}function b(e){var n="function"==typeof Map?new Map:void 0;return(b=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}}),d(t,e)})(e)}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}var y=(0,e.lazy)(function(){return v.e("300").then(v.bind(v,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&&d(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 s=[c,u];if(t)throw TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=n.call(e,i)}catch(e){s=[6,e],r=0}finally{t=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}(this,function(n){return new s(this.engine.context).register(),this.app.pluginSettingsManager.add(o,{title:'{{t("Localization", { ns: "'.concat(o,'" })}}'),icon:"GlobalOutlined",Component:y,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){l(i,r,o,a,c,"next",e)}function c(e){l(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}(b(e.Plugin)),w=m}(),O}()});
|
|
@@ -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 j},LocalizationPageContent:function(){return I}});var r=n(375),l=n(477),a=n(230),o=n(485),i=n(694),c=n(550),u=n(625),s=n(59),m=n(155),d=n.n(m),f=n(941),p=JSON.parse('{"UU":"@nocobase/plugin-localization"}').UU;function g(){var e=(0,i.useFlowEngine)();return function(t){return e.context.t(t,{ns:[p,"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),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,l)}function y(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 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 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 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:c(0)}),i(o,"throw",{value:c(1)}),i(o,"return",{value:c(2)}),"function"==typeof Symbol&&i(o,Symbol.iterator,{value:function(){return this}}),o;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&u[0]?r.return:u[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,u[1])).done)return l;switch(r=0,l&&(u=[2&u[0],l.value]),u[0]){case 0:case 1:l=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(l=(l=a.trys).length>0&&l[l.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!l||u[1]>l[0]&&u[1]<l[3])){a.label=u[1];break}if(6===u[0]&&a.label<l[1]){a.label=l[1],l=u;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(u);break}l[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=l=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function C(){var e,t,n=(e=["\n .editable-cell {\n position: relative;\n }\n\n .editable-cell-value-wrap {\n min-height: 32px;\n padding: 5px 12px;\n cursor: pointer;\n }\n\n &:hover .editable-cell-value-wrap {\n border: 1px solid #d9d9d9;\n border-radius: 4px;\n padding: 4px 11px;\n }\n\n [data-theme='dark'] &:hover .editable-cell-value-wrap {\n border: 1px solid #434343;\n }\n"],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return C=function(){return n},n}var k=s.Typography.Text,O=(0,l.css)(C());function T(e){var t,n=e.api,r=e.t,l=e.task,o=e.values,i=e.languageOptions,u=e.onChange,p=e.onPreviewChange,g=w((0,m.useState)(o.scope||"all"),2),h=g[0],v=g[1],y=w((0,m.useState)(o.referenceLocales),2),S=y[0],C=y[1],O=w((0,m.useState)(),2),T=O[0],P=O[1],x=w((0,m.useState)(!1),2),j=x[0],I=x[1],F="selected"===l.mode,z=(0,m.useMemo)(function(){return[{label:r("All"),value:"all"},{label:r("Built-in entries"),value:"builtIn"},{label:r("Custom entries"),value:"custom"}]},[r]),R=!F&&"custom"!==h,L=!F&&"builtIn"!==h,B=function(e){return d().createElement("span",{style:{fontWeight:400}},e)};(0,m.useEffect)(function(){u({scope:h,referenceLocales:S})},[u,S,h]),(0,m.useEffect)(function(){var e=!1,t=E(b({},o),{scope:h});return I(!0),p({count:0,loading:!0}),n.resource(f.ft).aiTranslatePreview({values:t}).then(function(t){if(!e){var n,r,l=(null==t||null==(r=t.data)?void 0:r.data)||(null==t?void 0:t.data);P(l),p({count:null!=(n=null==l?void 0:l.count)?n:0,loading:!1})}}).catch(function(t){e||s.message.error((null==t?void 0:t.message)||r("Failed to create async task"))}).finally(function(){e||I(!1)}),function(){e=!0}},[n,p,h,r,o]);var D=(null==T?void 0:T.providerTitle)?a.Schema.compile(T.providerTitle,{t:r}):null==T?void 0:T.provider,A=(null==T?void 0:T.model)?(0,c.formatModelLabel)(T.model):void 0;return d().createElement(s.Space,{direction:"vertical",size:12,style:{width:"100%"}},d().createElement(s.Typography.Paragraph,{style:{marginBottom:0}},l.description),F?null:d().createElement("div",null,d().createElement(k,{strong:!0},r("Translation scope")),d().createElement("div",{style:{marginTop:8}},d().createElement(s.Radio.Group,{value:h,options:z,onChange:function(e){return v(e.target.value)}})),d().createElement(s.Typography.Paragraph,{type:"secondary",style:{marginTop:8,marginBottom:0}},r("Built-in entries are system and plugin entries. Custom entries include route names, collection and field names, and UI content."))),d().createElement("div",null,d().createElement(k,{strong:!0},r("Entries to translate")),": ",j?r("Loading..."):null!=(t=null==T?void 0:T.count)?t:0),d().createElement("div",null,d().createElement(k,{strong:!0},r("Provider")),": ",D||"-"),d().createElement("div",null,d().createElement(k,{strong:!0},r("Model")),": ",A||"-"),d().createElement(s.Form,{layout:"vertical",initialValues:{referenceLocales:F?E(b({},S),{common:S.custom}):S},onValuesChange:function(e,t){var n=t.referenceLocales;if(F&&(null==n?void 0:n.common))C({builtIn:n.common,custom:n.common});else{var r=n||{};C((r.common,function(e,t){if(null==e)return{};var n,r,l,a={};if("u">typeof Reflect&&Reflect.ownKeys){for(l=0,n=Reflect.ownKeys(Object(e));l<n.length;l++)r=n[l],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}if(a=function(e,t){if(null==e)return{};var n,r,l={},a=Object.getOwnPropertyNames(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}(e,t),Object.getOwnPropertySymbols)for(l=0,n=Object.getOwnPropertySymbols(e);l<n.length;l++)r=n[l],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}(r,["common"])))}}},F?d().createElement("div",null,d().createElement(k,{strong:!0},r("Reference translation")),d().createElement(s.Row,{gutter:12},d().createElement(s.Col,{span:12},d().createElement(s.Form.Item,{name:["referenceLocales","common","primary"],label:B(r("Default language"))},d().createElement(s.Select,{showSearch:!0,optionFilterProp:"label",options:i}))),d().createElement(s.Col,{span:12},d().createElement(s.Form.Item,{name:["referenceLocales","common","fallback"],label:B(r("Fallback language"))},d().createElement(s.Select,{showSearch:!0,optionFilterProp:"label",options:i}))))):null,R?d().createElement("div",null,d().createElement(k,{strong:!0},r("Built-in entries reference translation")),d().createElement(s.Row,{gutter:12},d().createElement(s.Col,{span:12},d().createElement(s.Form.Item,{name:["referenceLocales","builtIn","primary"],label:B(r("Default language"))},d().createElement(s.Select,{showSearch:!0,optionFilterProp:"label",options:i}))),d().createElement(s.Col,{span:12},d().createElement(s.Form.Item,{name:["referenceLocales","builtIn","fallback"],label:B(r("Fallback language"))},d().createElement(s.Select,{showSearch:!0,optionFilterProp:"label",options:i}))))):null,L?d().createElement("div",null,d().createElement(k,{strong:!0},r("Custom entries reference translation")),d().createElement(s.Row,{gutter:12},d().createElement(s.Col,{span:12},d().createElement(s.Form.Item,{name:["referenceLocales","custom","primary"],label:B(r("Default language"))},d().createElement(s.Select,{showSearch:!0,optionFilterProp:"label",options:i}))),d().createElement(s.Col,{span:12},d().createElement(s.Form.Item,{name:["referenceLocales","custom","fallback"],label:B(r("Fallback language"))},d().createElement(s.Select,{showSearch:!0,optionFilterProp:"label",options:i}))))):null))}function P(e,t){return a.Schema.compile(e,{t:t})}var x=function(e){var t=e.value,n=e.record,r=e.onSave,l=w((0,m.useState)(!1),2),a=l[0],o=l[1],i=w((0,m.useState)(t||""),2),c=i[0],u=i[1],f=w((0,m.useState)(!1),2),p=f[0],g=f[1],h=(0,m.useRef)(null),v=(0,m.useRef)(!1);(0,m.useEffect)(function(){u(t||"")},[t]),(0,m.useEffect)(function(){if(a){var e,t;null==(t=h.current)||null==(e=t.focus)||e.call(t)}},[a]);var b=function(){v.current=!0,u(t||""),o(!1)};return a?d().createElement(s.Input,{ref:h,value:c,disabled:p,onBlur:function(){return y(function(){return S(this,function(e){switch(e.label){case 0:if(v.current)return v.current=!1,[2];if(c===(t||""))return o(!1),[2];g(!0),e.label=1;case 1:return e.trys.push([1,,3,4]),[4,r(n,c)];case 2:return e.sent(),o(!1),[3,4];case 3:return g(!1),[7];case 4:return[2]}})})()},onChange:function(e){return u(e.target.value)},onPressEnter:function(e){return e.currentTarget.blur()},onKeyDown:function(e){"Escape"===e.key&&b()}}):d().createElement("div",{className:"editable-cell"},d().createElement("div",{className:"editable-cell-value-wrap",onClick:function(){v.current=!1,u(t||""),o(!0)}},t))};function j(){return d().createElement(I,null)}function I(){var e,t,n,l=(0,i.useFlowContext)(),a=g(),c=l.app.apiClient,p=(null==(e=(t=c.auth).getLocale)?void 0:e.call(t))||c.auth.locale||"en-US",h=w(s.Form.useForm(),1)[0],v=w((0,m.useState)({page:1,pageSize:50,hasTranslation:!0}),2),C=v[0],T=v[1],j=w((0,m.useState)([]),2),I=j[0],R=j[1],L=w((0,m.useState)(null),2),B=L[0],D=L[1],A=(null==(n=o.languageCodes[p])?void 0:n.label)||p,M=(0,u.useRequest)(function(){return y(function(){return S(this,function(e){switch(e.label){case 0:return[4,c.resource(f.qQ).list(E(b({},C),{hasTranslation:String(C.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:[C]}),U=M.data,_=M.loading,K=M.refresh,N=(0,u.useRequest)(function(){return y(function(){var e,t;return S(this,function(n){switch(n.label){case 0:return[4,c.resource(f.ft).getSources()];case 1:return[2,(null==(t=n.sent())||null==(e=t.data)?void 0:e.data)||[]]}})})()}),q=N.data,G=N.loading,V=(null==U?void 0:U.rows)||[],Y=(0,m.useMemo)(function(){return((null==U?void 0:U.modules)||[]).map(function(e){return{value:e.value,label:P(e.label,a)}})},[null==U?void 0:U.modules,a]);(0,m.useEffect)(function(){B?h.setFieldsValue({translation:B.translation}):h.resetFields()},[B,h]);var J=function(e){T(function(t){return E(b({},t,e),{page:1})})},W=function(e,t){return y(function(){var n;return S(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,c.resource(f.MY).updateOrCreate({filterKeys:["textId","locale"],values:{textId:e.id,locale:p,translation:t}})];case 1:return r.sent(),K(),[3,3];case 2:return n=r.sent(),s.message.error((null==n?void 0:n.message)||a("Failed to save translation")),[3,3];case 3:return[2]}})})()},Q=[{title:a("Text"),dataIndex:"text",ellipsis:!0},{title:a("Translation"),dataIndex:"translation",ellipsis:!0,render:function(e,t){return d().createElement(x,{value:e,record:t,onSave:W})}},{title:a("Module"),dataIndex:"moduleTitle",width:220,render:function(e,t){return t.moduleTitle?d().createElement(s.Tag,null,P(t.moduleTitle,a)):d().createElement(s.Tag,null,t.module)}},{title:a("Actions"),key:"actions",width:240,render:function(e,t){return d().createElement(s.Space,{split:d().createElement(s.Divider,{type:"vertical"}),style:{whiteSpace:"nowrap"}},d().createElement(s.Button,{type:"link",size:"small",onClick:function(){return D(t)}},a("Edit")),t.translationId?d().createElement(s.Popconfirm,{title:a("Delete translation"),description:a("Are you sure you want to delete it?"),onConfirm:function(){return y(function(){return S(this,function(e){switch(e.label){case 0:if(!t.translationId)return[2];return[4,c.resource(f.MY).destroy({filterByTk:t.translationId})];case 1:return e.sent(),K(),[2]}})})()}},d().createElement(s.Button,{type:"link",size:"small"},a("Delete translation"))):null)}}],$={current:(null==U?void 0:U.page)||C.page,pageSize:(null==U?void 0:U.pageSize)||C.pageSize,total:(null==U?void 0:U.count)||0,showSizeChanger:!0,onChange:function(e,t){return T(function(n){return E(b({},n),{page:e,pageSize:t})})}};return d().createElement(s.Card,{bordered:!1},d().createElement(s.Space,{direction:"vertical",size:16,style:{width:"100%"}},d().createElement(s.Row,{justify:"space-between",align:"middle",gutter:[16,16]},d().createElement(s.Col,{flex:"auto"},d().createElement(s.Space,{wrap:!0,align:"center"},d().createElement(s.Typography,null,d().createElement(k,{strong:!0},a("Current language")),d().createElement(s.Tag,{style:{marginLeft:10}},A)),d().createElement(s.Select,{allowClear:!0,showSearch:!0,optionFilterProp:"label",placeholder:a("Module"),style:{minWidth:220},options:Y,onChange:function(e){return J({module:e})}}),d().createElement(s.Input.Search,{allowClear:!0,placeholder:a("Keyword"),style:{width:220},onSearch:function(e){return J({keyword:e})}}),d().createElement(s.Radio.Group,{optionType:"button",value:C.hasTranslation,onChange:function(e){return J({hasTranslation:e.target.value})},options:[{label:a("All"),value:!0},{label:a("No translation"),value:!1}]}))),d().createElement(s.Col,null,d().createElement(s.Space,{wrap:!0,align:"center"},d().createElement(s.Popconfirm,{title:a("Delete translation"),description:a("Are you sure you want to delete it?"),onConfirm:function(){return y(function(){var e,t;return S(this,function(n){switch(n.label){case 0:if(e=new Set(I.map(function(e){return String(e)})),!(t=V.filter(function(t){return e.has(String(t.id))}).map(function(e){return e.translationId}).filter(Boolean)).length)return s.message.error(a("Please select the records you want to delete")),[2];return[4,c.resource(f.MY).destroy({filterByTk:t})];case 1:return n.sent(),R([]),K(),[2]}})})()}},d().createElement(s.Button,{danger:!0,disabled:!I.length},a("Delete translation"))),d().createElement(s.Button,{icon:d().createElement(r.ReloadOutlined,null),loading:_,onClick:K},a("Refresh")),d().createElement(z,{sources:void 0===q?[]:q,loading:G,refresh:K}),d().createElement(s.Button,{type:"primary",icon:d().createElement(r.UploadOutlined,null),onClick:function(){return y(function(){return S(this,function(e){switch(e.label){case 0:return[4,c.resource(f.ft).publish()];case 1:return e.sent(),window.location.reload(),[2]}})})()}},a("Publish")),d().createElement(F,{selectedRowKeys:I})))),d().createElement(s.Table,{rowKey:"id",loading:_,columns:Q,dataSource:V,pagination:$,rowClassName:O,rowSelection:{selectedRowKeys:I,onChange:R}})),d().createElement(s.Drawer,{title:a("Edit"),open:!!B,width:720,onClose:function(){return D(null)},footer:d().createElement(s.Space,{style:{display:"flex",justifyContent:"flex-end"}},d().createElement(s.Button,{onClick:function(){return D(null)}},a("Cancel")),d().createElement(s.Button,{type:"primary",onClick:function(){return y(function(){var e;return S(this,function(t){switch(t.label){case 0:return[4,h.validateFields()];case 1:if(e=t.sent(),!B)return[2];return[4,W(B,e.translation)];case 2:return t.sent(),D(null),[2]}})})()}},a("Submit")))},B?d().createElement(s.Space,{direction:"vertical",size:16,style:{width:"100%"}},d().createElement("div",null,d().createElement(k,{strong:!0},a("Module")),d().createElement("div",{style:{marginTop:8}},B.moduleTitle?d().createElement(s.Tag,null,P(B.moduleTitle,a)):d().createElement(s.Tag,null,B.module))),d().createElement("div",null,d().createElement(k,{strong:!0},a("Text")),d().createElement(s.Typography.Paragraph,{style:{marginTop:8}},B.text)),d().createElement(s.Form,{form:h,layout:"vertical"},d().createElement(s.Form.Item,{name:"translation",label:d().createElement(k,{strong:!0},a("Translation")),rules:[{required:!0,message:a("Translation")}]},d().createElement(s.Input.TextArea,{autoSize:{minRows:4}})))):null))}function F(e){var t,n,r,l,a,u,p=e.selectedRowKeys,h=(0,i.useFlowContext)(),v=g(),C=h.app.apiClient,k=(null==(t=(n=C.auth).getLocale)?void 0:t.call(n))||C.auth.locale||"en-US",O=null==(u=h.systemSettings)||null==(a=u.data)||null==(l=a.data)||null==(r=l.enabledLanguages)?void 0:r[0],P=w((0,m.useState)(),2),x=P[0],j=P[1],I=(0,m.useMemo)(function(){return Object.entries(o.languageCodes).map(function(e){var t=w(e,2),n=t[0];return{value:n,label:t[1].label||n}})},[]),F=(0,m.useMemo)(function(){return{builtIn:{primary:"zh-CN",fallback:"ja-JP"},custom:{primary:O||"en-US",fallback:"zh-CN"}}},[O]),z=[{mode:"incremental",title:v("Incremental translation"),description:v("Translate entries that do not yet have a translation in the current language.")},{mode:"selected",title:v("Selected translation"),description:v("Translate only the selected entries in the table.")},{mode:"full",title:v("Full translation"),description:v("Translate all entries in the current language, including existing translations.")}];return d().createElement(c.AIEmployeeShortcut,{aiEmployee:{username:"lina"},tasks:z,size:32,mask:!1,onTaskClick:function(e){return y(function(){var t,n,r,l,a,o,i,c,u,m,g;return S(this,function(y){switch(y.label){case 0:if("selected"===(t=e.mode)&&!p.length)return s.message.error(v("Please select the records you want to translate")),[2];j(e.title),y.label=1;case 1:return y.trys.push([1,5,6,7]),[4,null==(r=h.systemSettings)||null==(n=r.load)?void 0:n.call(r)];case 2:return i=(null==(o=y.sent())||null==(a=o.data)||null==(l=a.enabledLanguages)?void 0:l[0])||F.custom.primary,c=E(b({},F),{custom:E(b({},F.custom),{primary:i})}),u={mode:t,scope:"all",locale:k,employeeUsername:"lina",referenceLocales:c,textIds:"selected"===t?p:void 0},m={count:0,loading:!0},[4,new Promise(function(t){s.Modal.confirm({title:e.title,width:640,content:d().createElement(T,{api:C,t:v,task:e,values:u,languageOptions:I,onChange:function(e){Object.assign(u,e)},onPreviewChange:function(e){Object.assign(m,e)}}),okText:v("Confirm"),cancelText:v("Cancel"),onOk:function(){return m.loading?(s.message.warning(v("Please wait for the translation preview to load")),Promise.reject()):m.count<=0?(s.message.warning(v("No entries to translate")),Promise.reject()):void t(!0)},onCancel:function(){return t(!1)}})})];case 3:if(!y.sent())return[2];return[4,C.resource(f.ft).aiTranslate({values:u})];case 4:return y.sent(),s.message.success(v("Async task created")),[3,7];case 5:return g=y.sent(),s.message.error((null==g?void 0:g.message)||v("Failed to create async task")),[3,7];case 6:return j(void 0),[7];case 7:return[2]}})})()},loadingTaskTitle:x,taskLoadingTitle:v("Creating...")})}function z(e){var t=e.sources,n=e.loading,l=e.refresh,a=(0,i.useFlowContext)(),o=g(),c=a.app.apiClient,u=w((0,m.useState)([]),2),p=u[0],h=u[1],v=w((0,m.useState)(!1),2),b=v[0],E=v[1],C=w((0,m.useState)(!1),2),k=C[0],O=C[1],T=(0,m.useMemo)(function(){return t.map(function(e){return e.name})},[t]);(0,m.useEffect)(function(){h(T)},[T]);var x=p.length>0&&p.length<T.length,j=T.length>0&&p.length===T.length;if(n)return null;var I=d().createElement(d().Fragment,null,d().createElement(s.Checkbox,{indeterminate:x,onChange:function(e){h(e.target.checked?T:[])},checked:j},o("All")),d().createElement(s.Divider,{style:{margin:"5px 0"}}),d().createElement(s.Checkbox.Group,{onChange:function(e){h(e)},value:p},d().createElement("div",null,t.map(function(e){return d().createElement("div",{key:e.name},d().createElement(s.Checkbox,{value:e.name},P(e.title,o)))}))),d().createElement(s.Divider,{style:{margin:"5px 0"}}),d().createElement(s.Checkbox,{checked:b,onChange:function(e){return E(e.target.checked)}},o("Reset built-in translations")));return d().createElement(s.Popover,{placement:"bottomRight",content:I},d().createElement(s.Button,{icon:d().createElement(r.SyncOutlined,null),loading:k,onClick:function(){return y(function(){return S(this,function(e){switch(e.label){case 0:if(!p.length)return[2,s.message.error(o("Please select the resources you want to synchronize"))];O(!0),e.label=1;case 1:return e.trys.push([1,,3,4]),[4,c.resource(f.ft).sync({values:{types:p,resetTranslations:b}})];case 2:return e.sent(),l(),[3,4];case 3:return O(!1),[7];case 4:return[2]}})})()}},o("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
|
-
|
|
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("@emotion/css"),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","@emotion/css","@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("@emotion/css"),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["@emotion/css"],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,s){return function(){"use strict";var l,f,p,d={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=c},477:function(e){e.exports=t},230:function(e){e.exports=a},485:function(e){e.exports=n},694:function(e){e.exports=u},550:function(e){e.exports=r},625:function(t){t.exports=e},59:function(e){e.exports=i},773:function(e){e.exports=s},155:function(e){e.exports=o}},b={};function h(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={exports:{}};return d[e](n,n.exports,h),n.exports}h.m=d,h.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return h.d(t,{a:t}),t},h.d=function(e,t){for(var n in t)h.o(t,n)&&!h.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},h.f={},h.e=function(e){return Promise.all(Object.keys(h.f).reduce(function(t,n){return h.f[n](e,t),t},[]))},h.u=function(e){return""+e+".0ec484505de4b04a.js"},h.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),h.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},y={},h.l=function(e,t,n,r){if(y[e])return void y[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,h.nc&&o.setAttribute("nonce",h.nc),o.setAttribute("data-rspack","@nocobase/plugin-localization/client-v2:"+n),o.src=e),y[e]=[t];var s=function(t,n){o.onerror=o.onload=null,clearTimeout(l);var r=y[e];if(delete y[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},l=setTimeout(s.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=s.bind(null,o.onerror),o.onload=s.bind(null,o.onload),i&&document.head.appendChild(o)},h.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},h.g.importScripts&&(v=h.g.location+"");var y,v,g=h.g.document;if(!v&&g&&(g.currentScript&&"SCRIPT"===g.currentScript.tagName.toUpperCase()&&(v=g.currentScript.src),!v)){var m=g.getElementsByTagName("script");if(m.length)for(var w=m.length-1;w>-1&&(!v||!/^http(s?):/.test(v));)v=m[w--].src}if(!v)throw Error("Automatic publicPath is not supported in this browser");h.p=v.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),l={889:0},h.f.j=function(e,t){var n=h.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=h.p+h.u(e),i=Error();h.l(o,function(t){if(h.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)}},f=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)h.o(i,n)&&(h.m[n]=i[n]);a&&a(h)}for(e&&e(t);c<o.length;c++)r=o[c],h.o(l,r)&&l[r]&&l[r][0](),l[r]=0},(p=self.webpackChunk_nocobase_plugin_localization_client_v2=self.webpackChunk_nocobase_plugin_localization_client_v2||[]).forEach(f.bind(null,0)),p.push=f.bind(null,p.push.bind(p));var x={};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/"}h.p=e}(),!function(){h.r(x),h.d(x,{default:function(){return d}});var e=h(485),t=h(773),n=h.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 s=[c,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[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=h(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&&l(o,n.prototype),o}).apply(null,arguments)}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=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,s(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),l(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=s(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||[],s(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&l(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 s=[c,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[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 h.e("796").then(h.bind(h,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))}(),x}()});
|
|
@@ -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;
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,19 +8,24 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@
|
|
12
|
-
"@formily/core": "2.3.7",
|
|
13
|
-
"@formily/react": "2.3.7",
|
|
14
|
-
"@nocobase/client": "2.1.0-alpha.4",
|
|
15
|
-
"ahooks": "3.7.8",
|
|
11
|
+
"@nocobase/client": "2.1.0-alpha.40",
|
|
16
12
|
"antd": "5.24.2",
|
|
17
13
|
"react": "18.2.0",
|
|
18
|
-
"@nocobase/flow-engine": "2.1.0-alpha.
|
|
19
|
-
"
|
|
20
|
-
"@nocobase/database": "2.1.0-alpha.
|
|
21
|
-
"@nocobase/server": "2.1.0-alpha.
|
|
22
|
-
"@nocobase/utils": "2.1.0-alpha.
|
|
23
|
-
"@nocobase/
|
|
24
|
-
"@nocobase/
|
|
25
|
-
"
|
|
14
|
+
"@nocobase/flow-engine": "2.1.0-alpha.40",
|
|
15
|
+
"@nocobase/client-v2": "2.1.0-alpha.40",
|
|
16
|
+
"@nocobase/database": "2.1.0-alpha.40",
|
|
17
|
+
"@nocobase/server": "2.1.0-alpha.40",
|
|
18
|
+
"@nocobase/utils": "2.1.0-alpha.40",
|
|
19
|
+
"@nocobase/plugin-async-task-manager": "2.1.0-alpha.40",
|
|
20
|
+
"@nocobase/cache": "2.1.0-alpha.40",
|
|
21
|
+
"@nocobase/ai": "2.1.0-alpha.40",
|
|
22
|
+
"react-i18next": "11.18.6",
|
|
23
|
+
"@formily/react": "2.3.7",
|
|
24
|
+
"lodash": "4.18.1",
|
|
25
|
+
"@ant-design/icons": "5.6.1",
|
|
26
|
+
"@emotion/css": "11.13.0",
|
|
27
|
+
"@nocobase/plugin-ai": "2.1.0-alpha.40",
|
|
28
|
+
"ahooks": "3.7.8",
|
|
29
|
+
"@nocobase/actions": "2.1.0-alpha.40",
|
|
30
|
+
"@langchain/core": "1.1.24"
|
|
26
31
|
};
|