Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n: locale override #775

Open
Elypha opened this issue Feb 16, 2024 · 0 comments
Open

i18n: locale override #775

Elypha opened this issue Feb 16, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Elypha
Copy link

Elypha commented Feb 16, 2024

Hello

  1. 我尝试按照docs中的示例修改i18n文本,例如
Artalk.init({
    // override i18n
    locale: {
        voteUp: "Like",
        voteDown: "Dislike",
    }
})

但似乎没有生效。

docs下面的评论里提到了placeholder的例子。docs中的示例是

Artalk.init({
  locale: {
    placeholder: 'こんにちは',
  }
})

而在我这边似乎需要修改为下面这样才生效(即成为conf的子元素 src

Artalk.init({
  placeholder: 'こんにちは',
})

而这个结构对于 voteUp 等来说又是无效的(简单看了一下似乎代码的实现方式不同? src

不清楚文档是否相对当前代码有过时信息,如果有的话希望可以更新一下!

  1. 另外,上面所述的覆盖文本的方法似乎是对所有语言生效的……?我在想是否可以实现更精细的文本管理

例如,在后端载入i18n文件

artalk-app/
| artalk
| artalk.yml
| i18n/
|- en-US.yml
|- ja-JP.yml

或者前端传入i18n object

Artalk.init({
    locale: "auto",
    i18n: {
        "en-US": {
            voteUp: "Like",
            // ...
        },
        "ja-JP": {
            voteUp: "いいね",
            // ...
        },
    },
});

毕竟是直接展示在用户端的文本,希望它能通过细粒度的调整支持更多类型/风格的服务

@qwqcode qwqcode added the bug Something isn't working label Feb 21, 2024
@qwqcode qwqcode added enhancement New feature or request and removed bug Something isn't working labels Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants