amis icon indicating copy to clipboard operation
amis copied to clipboard

JS SDK 多语言不生效

Open chaos1ee opened this issue 2 years ago • 2 comments

描述问题:

当使用 JS SDK 时,在 JSON 配置中设置多语言不生效。

截图或视频:

CC61F51E-F65D-43CD-BA11-5944A1BD2759

如何复现(请务必完整填写下面内容):

  1. 将项目 https://github.com/aisuda/amis-admin.git 克隆到本地,切换到 master 分支;
  2. 设置项目的 locale 为 en-US;

index.html

let amisInstance = amis.embed(
  '#root',
  app,
  {
    location: history.location,
    locale: 'en-US', // 设置 locale
  }
)
  1. 更改 JSON schema 中的多语言配置;

pages/crud-new.json

{
  type: 'text',
  name: 'engine',
  required: true,
  inline: false,
  description: '',
  descriptionClassName: 'help-block',
  placeholder: '',
  addOn: null,
  label: '引擎',
  'en-US': {
    label: 'engine',  // locale 为 “en-US” 时应该匹配这个 label。
  },
}

上述用法参考 https://aisuda.bce.baidu.com/amis/zh-CN/docs/extend/i18n#json-%E9%85%8D%E7%BD%AE%E4%B8%AD%E8%AE%BE%E7%BD%AE%E5%A4%9A%E8%AF%AD%E8%A8%80

期望:

使用 JS SDK 可以正常使用多语言功能。

chaos1ee avatar Jul 21 '22 09:07 chaos1ee

👍 Thanks for this! 🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.

github-actions[bot] avatar Jul 21 '22 09:07 github-actions[bot]

+1

gexMichael avatar Jul 22 '22 13:07 gexMichael

同问,这个问题解决了吗?

gaga1990 avatar Oct 07 '22 12:10 gaga1990