alibaba / alibaba/lowcode-engine

渲染层对于国际化的处理是否没考虑有参数的情况?

Open
#2,883 2 comments 0 reactions 1 assignee Claimed by @1ncounter View on GitHub
Dominant language
TypeScript
Stars
15.9k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

假设有语言包
```
"i18n": {
"zh-CN": {
"i18n-jwg27yo4": "你好 ",
"i18n-jwg27yo3": "{name} 博士",
"i18n-jwg27yo5": "你好 {text}"
},
"en-US": {
"i18n-jwg27yo4": "Hello ",
"i18n-jwg27yo3": "Doctor {name}"
}
}
```

按协议来说,params为参数
![image](https://github.com/alibaba/lowcode-engine/assets/38473196/0198cc09-55ca-4e88-8e3b-3af66ebf69f6)

那么可以期望如下schema正常渲染成`你好 Micheal`,但`Micheal`并没有显示出来
```
{
"componentName": "NextText",
"id": "node_oclrsyd6xtq",
"props": {
"type": "inherit",
"children": {
"type": "i18n",
"key": "i18n-jwg27yo4",
"params": {
"text": "Micheal"
}
},
"mark": false,
"code": false,
"delete": false,
"underline": false,
"strong": false,
"prefix": "",
"classname": ""
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
}
```

找到解析国际化数据的代码在这里,发现并没有处理params,是有问题还是我理解有误?:
https://github.com/alibaba/lowcode-engine/blob/4025a7d2e00f06501121485dcbce7ecdefb7b9ce/packages/renderer-core/src/utils/common.ts#L318-L328

另外,额外问个问题,协议里的`JSDataType`是什么?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.