@nocobase/plugin-localization 1.0.0-alpha.1
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 +661 -0
- package/README.md +35 -0
- package/client.d.ts +3 -0
- package/client.js +65 -0
- package/dist/client/Localization.d.ts +2 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.js +1 -0
- package/dist/client/locale/index.d.ts +2 -0
- package/dist/client/schemas/localization.d.ts +2 -0
- package/dist/externalVersion.js +15 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +39 -0
- package/dist/locale/en-US.json +24 -0
- package/dist/locale/ko_KR.json +23 -0
- package/dist/locale/zh-CN.json +24 -0
- package/dist/node_modules/deepmerge/.editorconfig +7 -0
- package/dist/node_modules/deepmerge/.eslintcache +1 -0
- package/dist/node_modules/deepmerge/dist/cjs.js +1 -0
- package/dist/node_modules/deepmerge/dist/umd.js +139 -0
- package/dist/node_modules/deepmerge/index.d.ts +20 -0
- package/dist/node_modules/deepmerge/index.js +106 -0
- package/dist/node_modules/deepmerge/license.txt +21 -0
- package/dist/node_modules/deepmerge/package.json +1 -0
- package/dist/node_modules/deepmerge/rollup.config.js +22 -0
- package/dist/server/actions/localization.d.ts +15 -0
- package/dist/server/actions/localization.js +229 -0
- package/dist/server/actions/localizationTexts.d.ts +5 -0
- package/dist/server/actions/localizationTexts.js +130 -0
- package/dist/server/collections/localization-texts.d.ts +2 -0
- package/dist/server/collections/localization-texts.js +86 -0
- package/dist/server/collections/localization-translations.d.ts +2 -0
- package/dist/server/collections/localization-translations.js +84 -0
- package/dist/server/constans.d.ts +8 -0
- package/dist/server/constans.js +48 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +33 -0
- package/dist/server/migrations/20230706200900-roles-add-translation.d.ts +6 -0
- package/dist/server/migrations/20230706200900-roles-add-translation.js +50 -0
- package/dist/server/migrations/20231206161851-fix-module.d.ts +6 -0
- package/dist/server/migrations/20231206161851-fix-module.js +91 -0
- package/dist/server/migrations/20240425224508-change-locale-module.d.ts +6 -0
- package/dist/server/migrations/20240425224508-change-locale-module.js +42 -0
- package/dist/server/migrations/20240426123538-delete-pkg-name-ns.d.ts +20 -0
- package/dist/server/migrations/20240426123538-delete-pkg-name-ns.js +73 -0
- package/dist/server/plugin.d.ts +15 -0
- package/dist/server/plugin.js +168 -0
- package/dist/server/resources.d.ts +19 -0
- package/dist/server/resources.js +86 -0
- package/dist/server/utils.d.ts +3 -0
- package/dist/server/utils.js +80 -0
- package/dist/swagger/index.json +156 -0
- package/package.json +28 -0
- package/server.d.ts +3 -0
- package/server.js +65 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.0.2",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "NocoBase API - Localization management plugin"
|
|
5
|
+
},
|
|
6
|
+
"tags": [],
|
|
7
|
+
"paths": {
|
|
8
|
+
"/localization:sync": {
|
|
9
|
+
"post": {
|
|
10
|
+
"tags": ["localization"],
|
|
11
|
+
"description": "Synchronize localization resources",
|
|
12
|
+
"parameters": [
|
|
13
|
+
{
|
|
14
|
+
"name": "X-Locale",
|
|
15
|
+
"in": "header",
|
|
16
|
+
"defalut": "en-US",
|
|
17
|
+
"schema": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"requestBody": {
|
|
23
|
+
"content": {
|
|
24
|
+
"application/json": {
|
|
25
|
+
"schema": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"properties": {
|
|
28
|
+
"type": {
|
|
29
|
+
"type": "array",
|
|
30
|
+
"items": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"enum": ["local", "menu", "db"]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"responses": {
|
|
41
|
+
"200": {
|
|
42
|
+
"description": "OK"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"/localization:publish": {
|
|
48
|
+
"post": {
|
|
49
|
+
"tags": ["localization"],
|
|
50
|
+
"description": "Publish localization resources (Reset cache)",
|
|
51
|
+
"parameters": [
|
|
52
|
+
{
|
|
53
|
+
"name": "X-Locale",
|
|
54
|
+
"in": "header",
|
|
55
|
+
"defalut": "en-US",
|
|
56
|
+
"schema": {
|
|
57
|
+
"type": "string"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"responses": {
|
|
62
|
+
"200": {
|
|
63
|
+
"description": "OK"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"/localizationTexts:list": {
|
|
69
|
+
"get": {
|
|
70
|
+
"tags": ["localizationTexts"],
|
|
71
|
+
"description": "Retrive localization texts with translations",
|
|
72
|
+
"parameters": [
|
|
73
|
+
{
|
|
74
|
+
"name": "X-Locale",
|
|
75
|
+
"in": "header",
|
|
76
|
+
"defalut": "en-US",
|
|
77
|
+
"schema": {
|
|
78
|
+
"type": "string"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "keyword",
|
|
83
|
+
"in": "query",
|
|
84
|
+
"description": "Search keyword",
|
|
85
|
+
"schema": {
|
|
86
|
+
"type": "string"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "hasTranslation",
|
|
91
|
+
"in": "query",
|
|
92
|
+
"description": "true - list all, false - list only untranslated",
|
|
93
|
+
"schema": {
|
|
94
|
+
"type": "boolean"
|
|
95
|
+
},
|
|
96
|
+
"defalut": true
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"responses": {
|
|
100
|
+
"200": {
|
|
101
|
+
"description": "OK"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"/localizationTranslations:updateOrCreate": {
|
|
107
|
+
"post": {
|
|
108
|
+
"tags": ["localizationTranslations"],
|
|
109
|
+
"description": "Update or create localization translations",
|
|
110
|
+
"parameters": [
|
|
111
|
+
{
|
|
112
|
+
"name": "textId",
|
|
113
|
+
"in": "query",
|
|
114
|
+
"schema": {
|
|
115
|
+
"type": "integer"
|
|
116
|
+
},
|
|
117
|
+
"required": true
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "locale",
|
|
121
|
+
"in": "query",
|
|
122
|
+
"schema": {
|
|
123
|
+
"type": "string"
|
|
124
|
+
},
|
|
125
|
+
"required": true
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
"requestBody": {
|
|
129
|
+
"content": {
|
|
130
|
+
"application/json": {
|
|
131
|
+
"schema": {
|
|
132
|
+
"type": "object",
|
|
133
|
+
"properties": {
|
|
134
|
+
"textId": {
|
|
135
|
+
"type": "integer"
|
|
136
|
+
},
|
|
137
|
+
"locale": {
|
|
138
|
+
"type": "string"
|
|
139
|
+
},
|
|
140
|
+
"translation": {
|
|
141
|
+
"type": "string"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"responses": {
|
|
149
|
+
"200": {
|
|
150
|
+
"description": "OK"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nocobase/plugin-localization",
|
|
3
|
+
"version": "1.0.0-alpha.1",
|
|
4
|
+
"main": "dist/server/index.js",
|
|
5
|
+
"homepage": "https://docs.nocobase.com/handbook/localization-management",
|
|
6
|
+
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/localization-management",
|
|
7
|
+
"license": "AGPL-3.0",
|
|
8
|
+
"devDependencies": {
|
|
9
|
+
"deepmerge": "^4.3.1"
|
|
10
|
+
},
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"@nocobase/cache": "1.x",
|
|
13
|
+
"@nocobase/client": "1.x",
|
|
14
|
+
"@nocobase/database": "1.x",
|
|
15
|
+
"@nocobase/plugin-client": "1.x",
|
|
16
|
+
"@nocobase/plugin-ui-schema-storage": "1.x",
|
|
17
|
+
"@nocobase/server": "1.x",
|
|
18
|
+
"@nocobase/test": "1.x"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"System management"
|
|
22
|
+
],
|
|
23
|
+
"displayName": "Localization",
|
|
24
|
+
"displayName.zh-CN": "本地化",
|
|
25
|
+
"description": "Allows to manage localization resources of the application.",
|
|
26
|
+
"description.zh-CN": "支持管理应用程序的本地化资源。",
|
|
27
|
+
"gitHead": "c73b6d2032a6151fdfeebeb0ec923d766578c53c"
|
|
28
|
+
}
|
package/server.d.ts
ADDED
package/server.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
4
|
+
if (typeof WeakMap !== 'function') return null;
|
|
5
|
+
var cacheBabelInterop = new WeakMap();
|
|
6
|
+
var cacheNodeInterop = new WeakMap();
|
|
7
|
+
return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
|
|
8
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
9
|
+
})(nodeInterop);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
13
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
14
|
+
return obj;
|
|
15
|
+
}
|
|
16
|
+
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
|
17
|
+
return { default: obj };
|
|
18
|
+
}
|
|
19
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
20
|
+
if (cache && cache.has(obj)) {
|
|
21
|
+
return cache.get(obj);
|
|
22
|
+
}
|
|
23
|
+
var newObj = {};
|
|
24
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
25
|
+
for (var key in obj) {
|
|
26
|
+
if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
27
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
28
|
+
if (desc && (desc.get || desc.set)) {
|
|
29
|
+
Object.defineProperty(newObj, key, desc);
|
|
30
|
+
} else {
|
|
31
|
+
newObj[key] = obj[key];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
newObj.default = obj;
|
|
36
|
+
if (cache) {
|
|
37
|
+
cache.set(obj, newObj);
|
|
38
|
+
}
|
|
39
|
+
return newObj;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var _index = _interopRequireWildcard(require('./dist/server'));
|
|
43
|
+
|
|
44
|
+
Object.defineProperty(exports, '__esModule', {
|
|
45
|
+
value: true,
|
|
46
|
+
});
|
|
47
|
+
var _exportNames = {};
|
|
48
|
+
Object.defineProperty(exports, 'default', {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _index.default;
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
Object.keys(_index).forEach(function (key) {
|
|
56
|
+
if (key === 'default' || key === '__esModule') return;
|
|
57
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
58
|
+
if (key in exports && exports[key] === _index[key]) return;
|
|
59
|
+
Object.defineProperty(exports, key, {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function get() {
|
|
62
|
+
return _index[key];
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
});
|