# 自定义头部链接区域在某些语言中不起作用

**URL:** https://meta.discourse.org/t/custom-header-link-locale-is-not-working-for-some-languages/365933
**Category:** Support
**Tags:** custom-header-links
**Created:** [2025年五月13日 15:45 UTC](https://meta.discourse.org/t/custom-header-link-locale-is-not-working-for-some-languages/365933 "2025-05-13T15:45:14Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Michael\_Liu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michael_liu/32/494049_2.png) [@Michael\_Liu](https://meta.discourse.org/u/Michael_Liu)
#### Post date: [2025年五月13日 15:45 UTC](https://meta.discourse.org/t/custom-header-link-locale-is-not-working-for-some-languages/365933/1 "2025-05-13T15:45:14Z")

</div>

recently I was trying to configure the custom header links to allow it shows up according to the specific language (locale) and realized this feature is not working as expected for some of the languages such as zh\_CN and en\_BG… seems whichever with “\_” in the middle of the string is not working but for “fr” “ca” “en”… are working smoothly.

what I have already tried.

firstly set forum locale to “en” then set custom header link locale to zh\_CN  
i logged in with an another regular user set interface language to zh\_CN then the header won’t showing up .

then I have also tried to set forum locale to “en” then set custom header link locale “ca” logged in with another regular user set interface language to “ca” as well then it shows the header .

which tells me the zh\_CN is not working as expected

really appreciate if someone can help me with this issue to make zh\_CN language works as expected

thanks a head

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [2025年五月13日 18:34 UTC](https://meta.discourse.org/t/custom-header-link-locale-is-not-working-for-some-languages/365933/3 "2025-05-13T18:34:44Z")

</div>

连字符应该可以，`zh-CN`，这是网络格式

当然，你不可能知道，所以我们应该纠正这一点——一旦这次更新上线，`-` 或 `_` 都可以使用

> <https://github.com/discourse/discourse-custom-header-links/pull/86>
>
> We weren't normalizing the locale, so if you're trying to use zh\_CN you're not g…oing to get a match for zh-CN 
> 
> After this change we should cover common capitalization and dash/underscore variations 
> 
> Reported here: https://meta.discourse.org/t/custom-header-link-locale-is-not-working-for-some-languages/365933

---

<div class="post-metadata">

### Author: ![Michael\_Liu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michael_liu/32/494049_2.png) [@Michael\_Liu](https://meta.discourse.org/u/Michael_Liu)
#### Post date: [2025年五月14日 01:29 UTC](https://meta.discourse.org/t/custom-header-link-locale-is-not-working-for-some-languages/365933/4 "2025-05-14T01:29:15Z")

</div>

是否可以将多个语言指向同一个 locale 字符串设置？

例如 locale: “en-US, en-UK”，因为对我来说，大多数情况应该是相同的，所以如果可能的话，将其作为一行配置会比使用两个完全相同的对象只更新 en-US 到 en-UK 要好得多。

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [2025年五月16日 21:13 UTC](https://meta.discourse.org/t/custom-header-link-locale-is-not-working-for-some-languages/365933/5 "2025-05-16T21:13:17Z")

</div>

目前还不可能，但应该是可行的。当我有时间的时候我可以试一试（或者其他人也可以随意提交 pull 请求！）

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [2025年五月16日 21:30 UTC](https://meta.discourse.org/t/custom-header-link-locale-is-not-working-for-some-languages/365933/6 "2025-05-16T21:30:22Z")

</div>

> [@Michael\_Liu](#):
>
> 例如区域设置：“en-US, en-UK”

仅使用 `en` 不就行了吗？

---

<div class="post-metadata">

### Author: ![Michael\_Liu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michael_liu/32/494049_2.png) [@Michael\_Liu](https://meta.discourse.org/u/Michael_Liu)
#### Post date: [2025年五月17日 04:24 UTC](https://meta.discourse.org/t/custom-header-link-locale-is-not-working-for-some-languages/365933/7 "2025-05-17T04:24:37Z")

</div>

不完全是，en 代表 en-US，en-GB 代表 en-UK，你可以试试

 ![The image shows a file directory with folders containing .yml files for translations, and an arrow pointing to a highlighted folder named sv.yml. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/9/c/9/9c9ed2ba0d4b59f45b04cc61d394710e82237ab7.png)  
你可以试试，不过没关系，只要我知道正确引用文件的正确方法，用“ - ”而不是“ \_ ”就足够了。

---

<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: [2025年六月16日 04:25 UTC](https://meta.discourse.org/t/custom-header-link-locale-is-not-working-for-some-languages/365933/8 "2025-06-16T04:25:34Z")

</div>

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