# 有没有办法根据位置向用户推荐地区？

**URL:** https://meta.discourse.org/t/any-way-to-recommend-locale-to-users-based-on-location/308612
**Category:** Support
**Created:** [2024年五月19日 14:53 UTC](https://meta.discourse.org/t/any-way-to-recommend-locale-to-users-based-on-location/308612 "2024-05-19T14:53:12Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![piffy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/piffy/32/254198_2.png) [@piffy](https://meta.discourse.org/u/piffy)
#### Post date: [2024年五月19日 14:53 UTC](https://meta.discourse.org/t/any-way-to-recommend-locale-to-users-based-on-location/308612/1 "2024-05-19T14:53:12Z")

</div>

我的网站主要是英文的，但偶尔也会有日本访客。Discourse 在语言可访问性方面是一个强大的工具，但我见过很多次用户_不知道他们可以更改自己的语言区域设置_。

这涉及到一系列相当复杂的操作。例如，在移动设备上：

- 打开头像侧边栏
- 按下用户图标
- 按下带有“Preferences”（偏好设置）英文标签的齿轮图标
- 向右滚动以查看带有计算机屏幕图标的第 7 个设置，标记为“Interface”（界面）
- 向下滚动到标记为“Interface language”（界面语言）的第 4 个设置

现在，如果你不懂英语但知道这个设置的存在，你也许能摸索着找到它，但我认为即使那样也会很棘手。

我喜欢 [Header Locale Selector](https://meta.discourse.org/t/header-locale-selector/240697) 中提出的想法，但你需要一个账户才能看到它（匿名访客是否可以更改语言区域设置？），而且它还占用了非常宝贵的页眉空间，用于一个用户一生中预计只会使用 0-1 次的设置。

所以我的问题是，是否有人有巧妙的方法来提示新用户（以及理想情况下的匿名用户）更改他们的语言设置，特别是当他们来自非英语主导国家时？

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [2024年五月19日 15:00 UTC](https://meta.discourse.org/t/any-way-to-recommend-locale-to-users-based-on-location/308612/2 "2024-05-19T15:00:10Z")

</div>

> [@piffy](#):
>
> 匿名用户

当您启用“从浏览器语言设置界面语言”时，请查看用户在其浏览器中选择的语言环境的界面。

> [@Variable default interface language for new users](https://meta.discourse.org/t/variable-default-interface-language-for-new-users/33741/47?u=moin):
>
> To allow the locale to be set for anonymous (non-logged in) users based on their browser’s language settings, you need to enable both the allow user locale and set locale from accept language header site settings. Both of those settings are found near the top of your site’s “Basic Setup” settings page. Once those settings are enabled, users who are not logged into the site will have the Discourse user interface automatically set to the preferred language they have set in their browser. If a non…

---

<div class="post-metadata">

### Author: ![piffy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/piffy/32/254198_2.png) [@piffy](https://meta.discourse.org/u/piffy)
#### Post date: [2024年五月19日 15:11 UTC](https://meta.discourse.org/t/any-way-to-recommend-locale-to-users-based-on-location/308612/3 "2024-05-19T15:11:00Z")

</div>

太好了，这正是我想要的，谢谢！

奇怪的是它默认是关闭的 🤔

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [2024年五月19日 15:13 UTC](https://meta.discourse.org/t/any-way-to-recommend-locale-to-users-based-on-location/308612/4 "2024-05-19T15:13:19Z")

</div>

我也认为那是因为“允许用户区域设置”默认情况下也是关闭的。

---

<div class="post-metadata">

### Author: ![piffy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/piffy/32/254198_2.png) [@piffy](https://meta.discourse.org/u/piffy)
#### Post date: [2024年五月19日 18:01 UTC](https://meta.discourse.org/t/any-way-to-recommend-locale-to-users-based-on-location/308612/6 "2024-05-19T18:01:58Z")

</div>

这也让我费解。这似乎是为了一个可辨识的原因（至少，在我看来没有可辨识的原因）而选择让网站对一部分用户来说更难用、更不易访问。

如果它默认开启，那么对于能阅读主要语言的任何用户都没有成本，并且对于任何以英语为第二语言的用户（就我的论坛而言）都有好处。

这相当于一个颜色设置，默认情况下，它会使网站对一小部分用户来说变成黑白的，并且是默认开启的。

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [2024年五月20日 11:12 UTC](https://meta.discourse.org/t/any-way-to-recommend-locale-to-users-based-on-location/308612/7 "2024-05-20T11:12:30Z")

</div>

我认为，当您允许用户选择自己的区域设置时，自定义网站会带来更多工作。例如，当您在不允许其他区域设置的情况下修改欢迎消息时，您只需更改一条文本。当您允许其他区域设置时，您必须为所有区域设置单独更改，如果您忘记了，并非所有用户都会在消息中获得相同的信息。主题组件（如搜索横幅或欢迎链接横幅）也是如此。当您查看 Discourse Discover 的国际部分时，您可以看到带有默认“欢迎来到我们的社区”文本的横幅截图。当我访问这些论坛时，我注意到其中许多都自定义了横幅文本，但它们没有为所有区域设置进行自定义。因此，虽然我看到了自定义文本，因为主题组件不提供默认的德语文本，但浏览器语言设置为英语（美国）的用户会看到默认文本，这正是截图时的情况。因此，目前这可能只会影响浏览器语言为英语（美国）的用户，而且翻译起来也不是很多工作。但是，当该组件添加英语（英国）时，管理员也必须更改这些字符串，然后有人可以添加德语，并且下一个文本也必须进行编辑。因此，您不仅要意识到必须为不同的区域设置更改字符串，还必须注意到何时添加了新的区域设置以进行自定义。

允许其他区域设置可能会给管理员带来更多工作。在一个人们只用一种语言交流的社区中，这可能不值得付出努力。用户无论如何都要处理语言问题。只有他们语言的界面几乎没有用。

---

<div class="post-metadata">

### Author: ![piffy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/piffy/32/254198_2.png) [@piffy](https://meta.discourse.org/u/piffy)
#### Post date: [2024年五月20日 15:36 UTC](https://meta.discourse.org/t/any-way-to-recommend-locale-to-users-based-on-location/308612/8 "2024-05-20T15:36:33Z")

</div>

我认为您的示例是实现选择，不一定非要如此。例如，每个实例都有一个默认区域设置。如果每个用户都获得完全相同的信息很重要，那么对于每一段文本，请检查是否覆盖了默认语言文本。如果覆盖了，而用户区域设置未被覆盖，则以默认区域设置显示文本。

或者，根本不这样做。保持原样。每种语言的默认文本都（或应该）设计得非常好。并非所有用户都能获得完全定制的体验，屏幕上的少数元素可能无济于事。但另一种选择是让 100% 的元素都无法阅读且无济于事。

在这两种情况下，管理员实际上只需要付出他们想要的额外工作。如果您不精通默认区域设置，那么为您翻译的每一段文本都是净收益。

我认为，将如此多的精力投入到使 Discourse 成为一个彻底且深入的多语言平台，但默认设置可能会使大多数站点完全成为单语站点，这是一种耻辱。这也意味着 Discourse 作为软件错失了向潜在采用者展示其丰富多语言平台的机会，因为我敢猜测，大多数实例都是纯英语的。在我看来，这是一个可访问性问题。

> [@Moin](#):
>
> 只有他们语言的界面用处不大。

我完全不同意。我曾有一位来自南美的用户，当我向他展示更改 UI 区域设置的选项时，他非常感激。这绝对改善了他的体验。另一位来自日本的用户访问时，解释说他在一个英语网站上发帖感到畏惧，并且在_上传图片_时遇到了很大的困难。他一直在回复之前上传就已完成。我检查了一下，注意到他的区域设置是英语，这首先促使了这个帖子。

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2024年六月19日 15:37 UTC](https://meta.discourse.org/t/any-way-to-recommend-locale-to-users-based-on-location/308612/9 "2024-06-19T15:37:02Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
