@nocobase/plugin-localization 1.2.13-alpha → 1.3.0-alpha.20240710084543

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/package.json +2 -2
  2. package/dist/client/Localization.d.ts +0 -10
  3. package/dist/client/index.d.ts +0 -13
  4. package/dist/client/index.js +0 -10
  5. package/dist/client/locale/index.d.ts +0 -10
  6. package/dist/client/schemas/localization.d.ts +0 -10
  7. package/dist/externalVersion.js +0 -24
  8. package/dist/index.d.ts +0 -10
  9. package/dist/index.js +0 -48
  10. package/dist/locale/en-US.json +0 -24
  11. package/dist/locale/ko_KR.json +0 -23
  12. package/dist/locale/zh-CN.json +0 -24
  13. package/dist/node_modules/deepmerge/.editorconfig +0 -7
  14. package/dist/node_modules/deepmerge/.eslintcache +0 -1
  15. package/dist/node_modules/deepmerge/dist/cjs.js +0 -1
  16. package/dist/node_modules/deepmerge/dist/umd.js +0 -139
  17. package/dist/node_modules/deepmerge/index.d.ts +0 -20
  18. package/dist/node_modules/deepmerge/index.js +0 -106
  19. package/dist/node_modules/deepmerge/license.txt +0 -21
  20. package/dist/node_modules/deepmerge/package.json +0 -1
  21. package/dist/node_modules/deepmerge/rollup.config.js +0 -22
  22. package/dist/server/actions/localization.d.ts +0 -23
  23. package/dist/server/actions/localization.js +0 -237
  24. package/dist/server/actions/localizationTexts.d.ts +0 -13
  25. package/dist/server/actions/localizationTexts.js +0 -139
  26. package/dist/server/collections/localization-texts.d.ts +0 -10
  27. package/dist/server/collections/localization-texts.js +0 -95
  28. package/dist/server/collections/localization-translations.d.ts +0 -10
  29. package/dist/server/collections/localization-translations.js +0 -93
  30. package/dist/server/constans.d.ts +0 -16
  31. package/dist/server/constans.js +0 -57
  32. package/dist/server/index.d.ts +0 -9
  33. package/dist/server/index.js +0 -42
  34. package/dist/server/migrations/20230706200900-roles-add-translation.d.ts +0 -14
  35. package/dist/server/migrations/20230706200900-roles-add-translation.js +0 -59
  36. package/dist/server/migrations/20231206161851-fix-module.d.ts +0 -14
  37. package/dist/server/migrations/20231206161851-fix-module.js +0 -100
  38. package/dist/server/migrations/20240425224508-change-locale-module.d.ts +0 -14
  39. package/dist/server/migrations/20240425224508-change-locale-module.js +0 -51
  40. package/dist/server/migrations/20240426123538-delete-pkg-name-ns.d.ts +0 -28
  41. package/dist/server/migrations/20240426123538-delete-pkg-name-ns.js +0 -82
  42. package/dist/server/plugin.d.ts +0 -23
  43. package/dist/server/plugin.js +0 -156
  44. package/dist/server/resources.d.ts +0 -27
  45. package/dist/server/resources.js +0 -101
  46. package/dist/server/utils.d.ts +0 -11
  47. package/dist/server/utils.js +0 -89
  48. package/dist/swagger/index.json +0 -156
@@ -1,237 +0,0 @@
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 localization_exports = {};
28
- __export(localization_exports, {
29
- default: () => localization_default,
30
- getResources: () => getResources,
31
- getSchemaUid: () => getSchemaUid,
32
- getTextsFromDB: () => getTextsFromDB,
33
- getTextsFromMenu: () => getTextsFromMenu,
34
- getUISchemas: () => getUISchemas
35
- });
36
- module.exports = __toCommonJS(localization_exports);
37
- var import_database = require("@nocobase/database");
38
- var import_constans = require("../constans");
39
- var import_utils = require("../utils");
40
- var import_server = require("@nocobase/server");
41
- const getResourcesInstance = async (ctx) => {
42
- const plugin = ctx.app.getPlugin("localization");
43
- return plugin.resources;
44
- };
45
- const getResources = async (ctx) => {
46
- const resources = await ctx.app.localeManager.getCacheResources(ctx.get("X-Locale") || "en-US");
47
- const result = {};
48
- Object.entries(resources).forEach(([module2, resource]) => {
49
- if (module2.startsWith(import_server.OFFICIAL_PLUGIN_PREFIX)) {
50
- const name = module2.replace(import_server.OFFICIAL_PLUGIN_PREFIX, "");
51
- if (resources[name]) {
52
- return;
53
- }
54
- }
55
- result[module2] = resource;
56
- });
57
- return result;
58
- };
59
- const getUISchemas = async (db) => {
60
- const uiSchemas = await db.getModel("uiSchemas").findAll({
61
- attributes: ["schema"],
62
- where: {
63
- [import_database.Op.or]: [
64
- {
65
- schema: {
66
- title: {
67
- [import_database.Op.ne]: null
68
- }
69
- }
70
- },
71
- {
72
- schema: {
73
- "x-component-props": {
74
- title: {
75
- [import_database.Op.ne]: null
76
- }
77
- }
78
- }
79
- },
80
- {
81
- schema: {
82
- "x-decorator-props": {
83
- title: {
84
- [import_database.Op.ne]: null
85
- }
86
- }
87
- }
88
- },
89
- {
90
- schema: {
91
- "x-data-templates": {
92
- [import_database.Op.ne]: null
93
- }
94
- }
95
- }
96
- ]
97
- }
98
- });
99
- return uiSchemas;
100
- };
101
- const getTextsFromDB = async (db) => {
102
- const result = {};
103
- const collections = Array.from(db.collections.values());
104
- for (const collection of collections) {
105
- const fields = Array.from(collection.fields.values()).filter((field) => {
106
- var _a;
107
- return (_a = field.options) == null ? void 0 : _a.translation;
108
- }).map((field) => field.name);
109
- if (!fields.length) {
110
- continue;
111
- }
112
- const repo = db.getRepository(collection.name);
113
- const records = await repo.find({ fields });
114
- records.forEach((record) => {
115
- const texts = (0, import_utils.getTextsFromDBRecord)(fields, record);
116
- texts.forEach((text) => result[text] = "");
117
- });
118
- }
119
- return result;
120
- };
121
- const getSchemaUid = async (db, migrate = false) => {
122
- if (migrate) {
123
- const systemSettings = await db.getRepository("systemSettings").findOne();
124
- const options = (systemSettings == null ? void 0 : systemSettings.options) || {};
125
- const { adminSchemaUid, mobileSchemaUid } = options;
126
- return { adminSchemaUid, mobileSchemaUid };
127
- }
128
- return { adminSchemaUid: "nocobase-admin-menu", mobileSchemaUid: "nocobase-mobile-container" };
129
- };
130
- const getTextsFromMenu = async (db, migrate = false) => {
131
- var _a, _b, _c, _d;
132
- const result = {};
133
- const { adminSchemaUid, mobileSchemaUid } = await getSchemaUid(db, migrate);
134
- const repo = db.getRepository("uiSchemas");
135
- if (adminSchemaUid) {
136
- const schema = await repo.getProperties(adminSchemaUid);
137
- const extractTitle = (schema2) => {
138
- if (schema2 == null ? void 0 : schema2.properties) {
139
- Object.values(schema2.properties).forEach((item) => {
140
- if (item.title) {
141
- result[item.title] = "";
142
- }
143
- extractTitle(item);
144
- });
145
- }
146
- };
147
- extractTitle(schema);
148
- }
149
- if (mobileSchemaUid) {
150
- const schema = await repo.getProperties(mobileSchemaUid);
151
- if ((_b = (_a = schema == null ? void 0 : schema["properties"]) == null ? void 0 : _a.tabBar) == null ? void 0 : _b.properties) {
152
- Object.values((_d = (_c = schema["properties"]) == null ? void 0 : _c.tabBar) == null ? void 0 : _d.properties).forEach((item) => {
153
- var _a2;
154
- const title = (_a2 = item["x-component-props"]) == null ? void 0 : _a2.title;
155
- if (title) {
156
- result[title] = "";
157
- }
158
- });
159
- }
160
- }
161
- return result;
162
- };
163
- const sync = async (ctx, next) => {
164
- const startTime = Date.now();
165
- ctx.logger.info("Start sync localization resources");
166
- const resourcesInstance = await getResourcesInstance(ctx);
167
- const locale = ctx.get("X-Locale") || "en-US";
168
- const { types = [] } = ctx.action.params.values || {};
169
- if (!types.length) {
170
- ctx.throw(400, ctx.t("Please provide synchronization source."));
171
- }
172
- let resources = { client: {} };
173
- if (types.includes("local")) {
174
- resources = await getResources(ctx);
175
- }
176
- if (types.includes("menu")) {
177
- const menuTexts = await getTextsFromMenu(ctx.db);
178
- resources[import_constans.NAMESPACE_MENUS] = {
179
- ...menuTexts
180
- };
181
- }
182
- if (types.includes("db")) {
183
- const dbTexts = await getTextsFromDB(ctx.db);
184
- resources[import_constans.NAMESPACE_COLLECTIONS] = {
185
- ...dbTexts
186
- };
187
- }
188
- let textValues = [];
189
- Object.entries(resources).forEach(([module2, resource]) => {
190
- Object.keys(resource).forEach((text) => {
191
- textValues.push({ module: `resources.${module2}`, text });
192
- });
193
- });
194
- textValues = await resourcesInstance.filterExists(textValues);
195
- await ctx.db.sequelize.transaction(async (t) => {
196
- const newTexts = await ctx.db.getModel("localizationTexts").bulkCreate(textValues, {
197
- transaction: t
198
- });
199
- const texts = await ctx.db.getModel("localizationTexts").findAll({
200
- include: [{ association: "translations", where: { locale }, required: false }],
201
- where: { "$translations.id$": null },
202
- transaction: t
203
- });
204
- const translationValues = texts.filter((text) => {
205
- var _a;
206
- const module2 = text.module.replace("resources.", "");
207
- return (_a = resources[module2]) == null ? void 0 : _a[text.text];
208
- }).map((text) => {
209
- var _a;
210
- const module2 = text.module.replace("resources.", "");
211
- return {
212
- locale,
213
- textId: text.id,
214
- translation: (_a = resources[module2]) == null ? void 0 : _a[text.text]
215
- };
216
- });
217
- await ctx.db.getModel("localizationTranslations").bulkCreate(translationValues, {
218
- transaction: t
219
- });
220
- await resourcesInstance.updateCacheTexts(newTexts);
221
- });
222
- ctx.logger.info(`Sync localization resources done, ${Date.now() - startTime}ms`);
223
- await next();
224
- };
225
- const publish = async (ctx, next) => {
226
- ctx.app.localeManager.reload();
227
- await next();
228
- };
229
- var localization_default = { publish, sync };
230
- // Annotate the CommonJS export names for ESM import in node:
231
- 0 && (module.exports = {
232
- getResources,
233
- getSchemaUid,
234
- getTextsFromDB,
235
- getTextsFromMenu,
236
- getUISchemas
237
- });
@@ -1,13 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Context, Next } from '@nocobase/actions';
10
- declare const _default: {
11
- list: (ctx: Context, next: Next) => Promise<void>;
12
- };
13
- export default _default;
@@ -1,139 +0,0 @@
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 localizationTexts_exports = {};
28
- __export(localizationTexts_exports, {
29
- default: () => localizationTexts_default
30
- });
31
- module.exports = __toCommonJS(localizationTexts_exports);
32
- var import_actions = require("@nocobase/actions");
33
- var import_database = require("@nocobase/database");
34
- var import_constans = require("../constans");
35
- const appendTranslations = async (db, rows, locale) => {
36
- const texts = rows || [];
37
- const textIds = texts.map((text) => text.id);
38
- const textMp = texts.reduce((memo, text) => {
39
- memo[text.id] = text;
40
- return memo;
41
- }, {});
42
- const repo = db.getRepository("localizationTranslations");
43
- const translations = await repo.find({
44
- filter: {
45
- locale,
46
- textId: textIds
47
- }
48
- });
49
- translations.forEach((translation) => {
50
- const text = textMp[translation.textId];
51
- if (text) {
52
- text.set("translation", translation.translation, { raw: true });
53
- text.set("translationId", translation.id, { raw: true });
54
- textMp[translation.textId] = text;
55
- }
56
- });
57
- return Object.values(textMp);
58
- };
59
- const listText = async (db, params) => {
60
- const { module: module2, keyword, hasTranslation, locale, options } = params;
61
- if (module2) {
62
- options["filter"] = { module: `resources.${module2}` };
63
- }
64
- if (keyword || !hasTranslation) {
65
- options["include"] = [{ association: "translations", where: { locale }, required: false }];
66
- if (!hasTranslation) {
67
- if (keyword) {
68
- options["filter"] = {
69
- ...options["filter"],
70
- text: {
71
- $includes: keyword
72
- }
73
- };
74
- }
75
- options["where"] = {
76
- "$translations.id$": null
77
- };
78
- } else {
79
- options["where"] = {
80
- [import_database.Op.or]: [
81
- { text: { [import_database.Op.like]: `%${keyword}%` } },
82
- { "$translations.translation$": { [import_database.Op.like]: `%${keyword}%` } }
83
- ]
84
- };
85
- }
86
- }
87
- const [rows, count] = await db.getRepository("localizationTexts").findAndCount(options);
88
- if (!hasTranslation) {
89
- return [rows, count];
90
- }
91
- return [await appendTranslations(db, rows, locale), count];
92
- };
93
- const list = async (ctx, next) => {
94
- const locale = ctx.get("X-Locale") || "en-US";
95
- let { page = import_actions.DEFAULT_PAGE, pageSize = import_actions.DEFAULT_PER_PAGE, hasTranslation } = ctx.action.params;
96
- page = parseInt(String(page));
97
- pageSize = parseInt(String(pageSize));
98
- hasTranslation = hasTranslation === "true" || hasTranslation === void 0;
99
- const { keyword, module: module2 } = ctx.action.params;
100
- const options = {
101
- context: ctx,
102
- offset: (page - 1) * pageSize,
103
- limit: pageSize
104
- };
105
- const [rows, count] = await listText(ctx.db, { module: module2, keyword, hasTranslation, locale, options });
106
- const cache = ctx.app.cache;
107
- const pm = ctx.app.pm;
108
- const plugins = await cache.wrap(`lm-plugins:${locale}`, () => pm.list({ locale }));
109
- const modules = [
110
- ...import_constans.EXTEND_MODULES,
111
- ...plugins.map((plugin) => ({
112
- value: plugin.alias || plugin.name,
113
- label: plugin.displayName
114
- }))
115
- ];
116
- for (const row of rows) {
117
- const moduleName = row.get("module").replace("resources.", "");
118
- const module3 = modules.find((module4) => module4.value === moduleName);
119
- if (module3) {
120
- row.set("moduleTitle", module3.label, { raw: true });
121
- }
122
- }
123
- ctx.body = {
124
- count,
125
- rows,
126
- page,
127
- pageSize,
128
- totalPage: Math.ceil(count / pageSize),
129
- modules: [
130
- ...import_constans.EXTEND_MODULES,
131
- ...plugins.map((plugin) => ({
132
- value: plugin.alias || plugin.name,
133
- label: plugin.displayName
134
- }))
135
- ]
136
- };
137
- await next();
138
- };
139
- var localizationTexts_default = { list };
@@ -1,10 +0,0 @@
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/database").CollectionOptions;
10
- export default _default;
@@ -1,95 +0,0 @@
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 localization_texts_exports = {};
28
- __export(localization_texts_exports, {
29
- default: () => localization_texts_default
30
- });
31
- module.exports = __toCommonJS(localization_texts_exports);
32
- var import_database = require("@nocobase/database");
33
- var localization_texts_default = (0, import_database.defineCollection)({
34
- dumpRules: {
35
- group: "required"
36
- },
37
- name: "localizationTexts",
38
- model: "LocalizationTextModel",
39
- createdBy: true,
40
- updatedBy: true,
41
- logging: true,
42
- shared: true,
43
- fields: [
44
- {
45
- name: "id",
46
- type: "bigInt",
47
- autoIncrement: true,
48
- primaryKey: true,
49
- allowNull: false,
50
- interface: "id"
51
- },
52
- {
53
- interface: "input",
54
- type: "string",
55
- name: "module",
56
- allowNull: false,
57
- uiSchema: {
58
- type: "string",
59
- title: '{{t("Module")}}',
60
- "x-component": "Select",
61
- required: true
62
- }
63
- },
64
- {
65
- interface: "input",
66
- type: "text",
67
- name: "text",
68
- allowNull: false,
69
- uiSchema: {
70
- type: "string",
71
- title: '{{t("Text")}}',
72
- "x-component": "Input",
73
- required: true
74
- }
75
- },
76
- {
77
- name: "batch",
78
- type: "string"
79
- },
80
- {
81
- interface: "o2m",
82
- type: "hasMany",
83
- name: "translations",
84
- target: "localizationTranslations",
85
- sourceKey: "id",
86
- foreignKey: "textId",
87
- onDelete: "CASCADE"
88
- }
89
- ],
90
- indexes: [
91
- {
92
- fields: ["batch"]
93
- }
94
- ]
95
- });
@@ -1,10 +0,0 @@
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/database").CollectionOptions;
10
- export default _default;
@@ -1,93 +0,0 @@
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 localization_translations_exports = {};
28
- __export(localization_translations_exports, {
29
- default: () => localization_translations_default
30
- });
31
- module.exports = __toCommonJS(localization_translations_exports);
32
- var import_database = require("@nocobase/database");
33
- var localization_translations_default = (0, import_database.defineCollection)({
34
- namespace: "localization.localization",
35
- dumpRules: {
36
- group: "required"
37
- },
38
- name: "localizationTranslations",
39
- model: "LocalizationTranslationModel",
40
- createdBy: true,
41
- updatedBy: true,
42
- logging: true,
43
- shared: true,
44
- fields: [
45
- {
46
- name: "id",
47
- type: "bigInt",
48
- autoIncrement: true,
49
- primaryKey: true,
50
- allowNull: false,
51
- interface: "id"
52
- },
53
- {
54
- interface: "input",
55
- type: "string",
56
- name: "locale",
57
- allowNull: false,
58
- uiSchema: {
59
- type: "string",
60
- title: '{{t("Locale")}}',
61
- "x-component": "Input",
62
- required: true
63
- }
64
- },
65
- {
66
- interface: "input",
67
- type: "text",
68
- name: "translation",
69
- allowNull: false,
70
- defaultValue: "",
71
- uiSchema: {
72
- type: "string",
73
- title: '{{t("Translation")}}',
74
- "x-component": "Input",
75
- required: true
76
- }
77
- },
78
- {
79
- interface: "m2o",
80
- type: "belongsTo",
81
- name: "text",
82
- target: "localizationTexts",
83
- targetKey: "id",
84
- foreignKey: "textId"
85
- }
86
- ],
87
- indexes: [
88
- {
89
- fields: ["locale", "textId"],
90
- unique: true
91
- }
92
- ]
93
- });
@@ -1,16 +0,0 @@
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 CACHE_KEY = "localization:texts";
10
- export declare const NAMESPACE_PREFIX = "lm-";
11
- export declare const NAMESPACE_MENUS: string;
12
- export declare const NAMESPACE_COLLECTIONS: string;
13
- export declare const EXTEND_MODULES: {
14
- value: string;
15
- label: string;
16
- }[];
@@ -1,57 +0,0 @@
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 constans_exports = {};
28
- __export(constans_exports, {
29
- CACHE_KEY: () => CACHE_KEY,
30
- EXTEND_MODULES: () => EXTEND_MODULES,
31
- NAMESPACE_COLLECTIONS: () => NAMESPACE_COLLECTIONS,
32
- NAMESPACE_MENUS: () => NAMESPACE_MENUS,
33
- NAMESPACE_PREFIX: () => NAMESPACE_PREFIX
34
- });
35
- module.exports = __toCommonJS(constans_exports);
36
- const CACHE_KEY = "localization:texts";
37
- const NAMESPACE_PREFIX = "lm-";
38
- const NAMESPACE_MENUS = `${NAMESPACE_PREFIX}menus`;
39
- const NAMESPACE_COLLECTIONS = `${NAMESPACE_PREFIX}collections`;
40
- const EXTEND_MODULES = [
41
- {
42
- value: NAMESPACE_MENUS,
43
- label: "Menu"
44
- },
45
- {
46
- value: NAMESPACE_COLLECTIONS,
47
- label: "Collections & Fields"
48
- }
49
- ];
50
- // Annotate the CommonJS export names for ESM import in node:
51
- 0 && (module.exports = {
52
- CACHE_KEY,
53
- EXTEND_MODULES,
54
- NAMESPACE_COLLECTIONS,
55
- NAMESPACE_MENUS,
56
- NAMESPACE_PREFIX
57
- });
@@ -1,9 +0,0 @@
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';