X Tutup
Skip to content

出码缺乏对于 i18n 数据的 params 的处理,变量替换也有问题 #288

@Clarence-pan

Description

@Clarence-pan

Describe the bug (required) / 详细描述 bug(必填)

A clear and concise description of what the bug is. / 请提供清晰且精确的 bug 描述


To Reproduce (required) / 如何复现 bug?(必填,非常重要)

相关 schema 片段:

{
    "componentName": "Text",
    "props": {
      "content": {
        "type": "i18n",
        "key": "greetings.hello",
        "params": {
          "name": {
            "type": "JSExpression",
            "value": "this.state.name"
          }
        }
      }
    }
  }

Steps to reproduce the behavior: / 详细复现步骤:
随便找个组件,拿上面的 schema 片段合并到 props 中,出码后生成的是这样的:

image

-- 按说对应的 JSExpression 应该是表达式,即出码成这样才合适:

 <Text
    content={this._i18nText({
      key: "greetings.hello",
      params: { name: this.state.name },
    })}
  />

此外,还有两个问题:

  1. icejs 解决方案内 this._i18nText 的实现中并未对 params 做变量替换
  2. rax 里虽然有变量替换,但是貌似并不支持规范定义的 "${xxx}" 的语法,而是支持的 "{xxx}" 的语法...

附:相关规范
image
image


English version example:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

中文版示例:

  1. 打开 demo
  2. 点击标题;
  3. 在右侧修改标题内容为「修改后的标题」;
  4. 渲染画布标题组件没有更新显示为「修改后的标题」;

Expected behavior (required) / 预期行为(必填,非常重要)

A clear and concise description of what did you expect to happen. / 请清晰和精确的描述你预期的行为


Screenshots (optional) / bug 截图(可选)

Sceenshots for further information. (If applicable.) / 一些有用的截图将会帮助我们更好的明确以及定位问题


Environments (please complete the following information) (required): / 请提供如下信息(必填)

  • AliLowCodeEngine version: [e.g. 1.0.0] / 低代码引擎版本
  • AliLowCodeEngineExt version: [e.g. 1.0.0] / 低代码引擎扩展包版本
  • Browser [e.g. chrome, safari] / 浏览器版本
  • materials / plugins / tools / 其他物料 / 插件 / 工具链版本

(this information can be collected via the manual plugin / 版本信息可通过低代码用户手册插件收集)

Additional context (optional) / 更多额外信息(可选)

Any other context of the problem here. / 可以追加更多的额外信息,帮助定位问题

Metadata

Metadata

Assignees

Labels

bugSomething isn't working / 明确是 bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    X Tutup