Chinese/Japanese/Korean localized username support 中文用户名支持

here is a simple plugin for add CJK charset allowed as username or group name.
中日韩用户名/群组名支持插件

https://github.com/zh99998/discourse-username-localization

Features

Allow Chinese、Japanese、Korean as username or group name.
允许使用中文、日文、韩文做用户名和群组名称

use Pinyin or Romaji first letter as default avatar for Chinese, Hiragana and Katakana username.
对于中文和日文假名用户名,将使用拼音首字母作为系统默认头像

Install

I don’t know how to replace the constant in routes and javascript, so i made a bash script to replace it. you may add it in app.yml like this.

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/zh99998/discourse-username-localization.git
          - bash discourse-username-localization/install.sh

Allowed characters

CJK Unified Ideographs blocks 4E00-9FD5
CJK Unified Ideographs Extension A 3400-4DBF
CJK Unified Ideographs Extension B 20000-2A6DF
CJK Unified Ideographs Extension C 2A700-2B73F
CJK Unified Ideographs Extension D 2B740–2B81F
CJK Unified Ideographs Extension E 2B820–2CEAF
CJK Compatibility Ideographs F900–FAFF
CJK Compatibility Ideographs Supplement 2F800-2FA1D
Hangul Syllables AC00–D7AF
Hiragana 3040–309F
Katakana 30A0–30FF
Katakana Phonetic Extensions 31F0–31FF
Kana Supplement 1B000–1B0FF

see Plane (Unicode) - Wikipedia and http://unicode.org/charts/for more information

Known issue

  • Pinyin/Romaji support is hacky, and not support Korean. other characters will make a avatar with “_” (I’d like to use “#” for unknown characters avatar, but don’t know how to do that)
  • Unicode homograph attack UTS #39: Unicode Security Mechanisms
  • not well-tested. I only tested in my site.

please make a pull request if you can get them better.

12 Likes

不得不赞一个;你刚刚修正了Known issue的第一个问题,可以更新下啦~

是修正了前两个。已经把这两个从 known issue 里去除了。

Thanks for this i really needed a Japanese username :3 Btw it shows 404 :confused:

Where shows 404?
Your site?

well never mind it worked! :smiley:

很好的插件,不知道能不能把这类特别针对中文的链接中好的几个插件搬运到discoursecn论坛上呢?
@zh99998

比如我发的一个帖子

希望可以在那里集结一批华语用户,对discourse进行大刀阔斧的本土化改造。

1 Like

非常好的插件!表示Discourse对中文兼容性不高一直是一个蛋疼的问题 :smile:

话说能否增加一个设置页面,用来设置将一个汉字视为多少个字符?

The plug-in always shows the failure of the installation, is the link valid?

Please check the new install readme in zh99998’s github page.

请问 Known issue里面是说有安全漏洞吗

现在中文用户名的支持官方已经完成了。

根据官方的说明,从 Discourse 2.3.0.beta9 版本开始,Discourse 就已经能够支持 Unicode 的用户名了,包括中文的用户名。

官方发布的文章为:https://meta.discourse.org/t/unicode-usernames-and-group-names/117737。

你需要对你的 Discourse 进行设置就行了。

设置位置

在管理员控制的设置中,搜索字符 unicode。

你就可以看到有个选项叫做 unicode usernames。

选择上这个选项就可以了。

如果你使用的是英文版语言的 Discourse 的话。

那么这个的配置选项就在这里了。

2 Likes