@steedos/service-i18n 2.5.18 → 2.5.19-beta.2
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/package.json +2 -2
- package/package.service.js +12 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-i18n",
|
|
3
3
|
"main": "package.service.js",
|
|
4
|
-
"version": "2.5.
|
|
4
|
+
"version": "2.5.19-beta.2",
|
|
5
5
|
"private": false,
|
|
6
6
|
"repository": "https://github.com/steedos/steedos-platform.git",
|
|
7
7
|
"description": "",
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
"publishConfig": {
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "fc946a6dd1aa34db1809edf505ddd1edce91fe1c"
|
|
18
18
|
}
|
package/package.service.js
CHANGED
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
* @Author: yinlianghui@steedos.com
|
|
3
3
|
* @Date: 2022-07-26 11:45:49
|
|
4
4
|
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
-
* @LastEditTime: 2023-
|
|
5
|
+
* @LastEditTime: 2023-07-19 14:58:21
|
|
6
6
|
* @Description:
|
|
7
7
|
*/
|
|
8
8
|
"use strict";
|
|
9
9
|
const project = require('./package.json');
|
|
10
10
|
const packageName = project.name;
|
|
11
11
|
const packageLoader = require('@steedos/service-package-loader');
|
|
12
|
-
|
|
12
|
+
const register = require('@steedos/metadata-registrar');
|
|
13
|
+
const steedosI18n = require("@steedos/i18n");
|
|
13
14
|
/**
|
|
14
15
|
* @typedef {import('moleculer').Context} Context Moleculer's Context
|
|
15
16
|
* 软件包服务启动后也需要抛出事件。
|
|
@@ -38,6 +39,15 @@ module.exports = {
|
|
|
38
39
|
* Actions
|
|
39
40
|
*/
|
|
40
41
|
actions: {
|
|
42
|
+
generateObjectTranslationTemplate: async function(ctx){
|
|
43
|
+
const {objectName, lng = 'zh-CN'} = ctx.params;
|
|
44
|
+
console.log(`generateObjectTranslationTemplate===`, objectName, lng)
|
|
45
|
+
if(!objectName){
|
|
46
|
+
return {}
|
|
47
|
+
}
|
|
48
|
+
const objectConfig = await register.getObjectConfig(objectName);
|
|
49
|
+
return steedosI18n.getObjectMetadataTranslationTemplate(lng, objectConfig.name, objectConfig, true);
|
|
50
|
+
},
|
|
41
51
|
},
|
|
42
52
|
|
|
43
53
|
/**
|