多语言网站:在注册时询问偏好的语言

非常感谢您提供允许用户选择其偏好语言的功能。这对生活在多语言环境中的社区非常有帮助!

您是否考虑过在注册时允许用户定义他们的偏好语言?这个时间点让用户做出选择是最有意义的,这样他们可以用自己偏好的语言发现新社区。

在注册表单中提供语言选择可以解决两个相关的问题:

  • Discobot 会用用户偏好的语言向他们发送第一条消息。这会让 Discobot 更酷,也更容易被所有人理解。目前没有解决方法,因为 Discobot 的第一条消息始终会用默认语言发送。
  • 发现可以更改语言的功能需要一定的技能,尤其是对于新用户,可能第一次使用复杂界面,或者使用自己不太流利的语言。用户需要知道这个功能的存在,并且它藏在用户设置的几乎最后一个角落。这可以通过在欢迎话题中添加提示来解决,但从多个角度来看,这并不是最佳方案。

选择偏好语言基本上是一项一次性选择。注册是最合适的时间点。实现这个功能可能并不复杂?

15 个赞

Sure we are open to a community pr in this area, need to see mockups first, optional default off

6 个赞

How about something like this?

I feel like we need a better copy for the instructions. IMO it shouldn’t exceed the width of the selectbox, but I couldn’t come up with a shorter one. Any ideas?

7 个赞

“Language: English” is quite self-explanatory. What about just removing the instructions?

1 个赞

I feel like this is a tad too late, what if categories allowed you to set locale in category settings?

Then when anon clicks on a topic or category in such a locale the interface could switch locales and clicking register would already be in the correct locale which could be carried over

3 个赞

Why the registration form is too late? If the user reached that form is because they could find their way in the default language of the forum, which would appear as default also in the form (i.e. Russian if the default is Russian, not English).

I guess we have two fundamental types of potential multilingual Discourse sites

  1. Support forums and similar international services or communities where you might find users from everywhere. Many unrelated languages can be expected, English acts as lingua franca, most users don’t know many of the languages.
  2. Multilingual communities sharing territory or cultural background. 2-3 related languages can be expected, English might not be one of them, and most users can probably read all of them and speak/write at least one.

In the first case different languages will be probably structured and separate. Switching locales for anonymous users and proceeding with @sam’s idea might work well.

However, in the second case things may (and frequently do) get quite mixed, and frictions are not uncommon. Imagine forums combining Russian-Ukranian, Bosnian-Croatian-Serbian…, Finnish-Swedish, Catalan-Spanish, Arabic-French… Anonymous users could be changing locales click after click. There administrators might prefer to avoid tying categories or topics to languages altogether, because that promotes some kind of segregation. Imagine a proud Ukranian speaker that, after reading the last topic in Russian, is offered Russian registration in a (maybe proud) Ukranian community.

If you have any friends from these regions in Facebook, go visit their walls and you’ll see. I bet it can be the same for i.e. Hebrew/English.

To make it even funnier, it is not uncommon that users reading, say, Catalan/Spanish with native fluency still prefer English UI because they are used to it. Therefore, you may have communities producing no English content but still having users who will choose the English locale.

3 个赞

There is already a site setting (set locale from accept language header) which uses the browser’s Accept-Language HTTP header for anonymous users. I guess this could be used to set the initial value for the locale on the registration form and it might already set the locale during signup.

You can find out more about this feature in Variable default interface language for new users. If I remember correctly there were some issues with caching.

6 个赞

There is a VERY strong order of operations problem here.

Yes I want to correct and improve this stuff but:

  • This MUST happen first, Is there any way to let language selector display 'English' instead of 'en'? I find it odd to even be talking about this stuff without this in place.

  • I feel like in many communities the category based “language” selection both solves a big problem with signup and leaves users with less choice which is great.

  • Involving Discobot in a multi lingual interface forum where people generally speak multiple language is a great way of introducing the concept of preference.

  • Whatever solution we come up with for signup should be more inline with what facebook do. Cause plenty of people on the planet have no idea what the glyphs “Language” mean. So how are they expected to even fill out the form.

8 个赞

Facebook sets their login form from the accept language headers. You have to clear your browser’s cookies to see it. A big difference between facebook and Discourse is that facebook doesn’t display content to anonymous users, so they only have to deal with the login page.

2 个赞

Sorry, was a bit vague there.

I meant that a combo box is kind of weak on the signup page. Instead a footer on the login modal that displays a list of languages (spelled in the actual language) is the way to go.

It does beg the question about how someone is going to even select “Sign Up” when they have no idea what those glyphs mean, which is why I am so uneasy about this.

I think automagically inferring language from the browser’s language setting is always preferable to what @icaria36 proposed, above, and we do support that via an experimental :man_scientist: site setting, set locale from set language header

It utterly destroys anon caching though which is why it is such a dangerous setting and not enabled by default.

So maybe this request only matters in the very narrow case of people who are multi-lingual, and hitting websites broadly available in multiple languages, who say

Oh my browser says I am in France but I speak French, English, German, and Chinese and right now I prefer to use Chinese on this particular website.

Furthermore, the “explicit language set per category” thing is also extremely strong, and matches the topic @erlend_sh already set up about localizing Discourse for multi-language sites.

1 个赞

Maybe the anonymous cache key could be set differently for forums that require login to view content. It would require having login_required and possibly supported_locales available as Global Settings. It could be useful for customer support forums.

2 个赞

Anon cache can add another header to its cache key, its quite a straightforward change.

3 个赞

Getting real tired of the off-topic posts here and I will be deleting aggressively. So before posting any more replies, re-read the title and first post and ask yourself, “Am I sure I am posting something that is actually what this topic is about?”

3 个赞

尽管这个请求已经存在近三年了,我仍想表示支持。目前的安排让不懂中文的用户感到十分困惑。注册页面使用的是他们浏览器的语言,但一旦加入,应用就会恢复为英文,这与我预期的应用设置不符。

当启用“从 Accept-Language 头设置区域”这一选项时,预期的行为是:账户应使用在请求头中检测到的区域进行创建。请问您的用户是如何创建账户的?如果账户是通过单点登录(SSO)创建的,这种方法将无法生效。在使用 SSO 登录时,区域信息需要在 SSO 负载中设置。

为确保该设置按预期工作,我临时在 https://try.discourse.org/ 上启用了该选项,将浏览器区域设置为法语,并尝试通过用户名/密码注册以及 Twitter 认证两种方式创建账户。在这两种情况下,我的用户区域都正确设置为法语。目前我已在 https://try.discourse.org/ 上禁用了该设置。

2 个赞

当启用“从 Accept-Language 头设置语言”选项时,预期行为是账户应以在头信息中找到的语言创建。

这也是我的预期。

您的网站上的用户是如何创建账户的?如果账户是通过 SSO 创建的,这种方法将不起作用。在使用 SSO 登录时,语言需要在 SSO 负载中设置。

我点击汉堡菜单,进入管理员,选择用户,发送邀请,点击发送邀请,随后会弹出一个对话框。我输入对方的电子邮件地址并点击发送邀请。我不知道还有其他添加用户的方式。

为了确保该设置按预期工作,我临时在 https://try.discourse.org/ 上启用了它,将浏览器的语言设置为法语,并尝试通过用户名/密码注册以及通过 Twitter 认证创建账户。在这两种情况下,我的用户语言都正确设置为法语。我现在已在 https://try.discourse.org/ 上禁用了该设置。

我不明白为什么您的结果会不同。当我使用备用电子邮件地址邀请自己,将备用浏览器的语言设置为法语,并在该浏览器中打开注册链接时,账户确认页面是法语的(在那里我选择用户名和密码),但之后的所有页面都是英文的。

1 个赞

这正是导致问题的原因。当用户通过接受邀请创建账户时,无论用户的浏览器语言设置如何,其语言区域都会被设置为站点的默认语言区域。这或许是我们能够修复的问题。

“从 Accept-Language 头设置语言区域”选项会在用户点击注册按钮并提交注册表单时,为其创建具有正确语言区域的账户。我们或许可以将同样的逻辑应用于用户通过接受邀请创建账户的情况。

3 个赞

@simon,这听起来很棒。例如,有时我们会有法语课程毕业生加入我们的社区。我知道他们说法语!

因此,当我发送邀请让他们加入社区时,如果能将他们的默认语言设置为法语,那就太好了。

1 个赞

在接受邀请时通过语言头部设置区域设置似乎是可行的,因为它应该使用与当前用户名/密码注册类似的逻辑。

我认为您想要的是在_发送_邀请时设置用户的区域设置的功能。我认为之前有人提出过这个需求。我能理解这对某些网站来说是一个有用的功能,但可能需要在多个网站提出该需求后,才会被实现。

3 个赞