# 主题翻译覆盖仅适用于管理员的语言

**URL:** https://meta.discourse.org/t/theme-translation-overrides-only-apply-to-the-administrators-language/226870
**Category:** Bug
**Created:** [2022年五月12日 14:18 UTC](https://meta.discourse.org/t/theme-translation-overrides-only-apply-to-the-administrators-language/226870 "2022-05-12T14:18:45Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [2022年五月12日 14:08 UTC](https://meta.discourse.org/t/theme-translation-overrides-only-apply-to-the-administrators-language/226870/1 "2022-05-12T14:08:37Z")

</div>

接续自：[Guest Gate Theme Component - #13 by davidkingham](https://meta.discourse.org/t/guest-gate-theme-component/225107/13?u=jammydodger)

谢谢 David！我认为这可能是一个 bug。我用 [Gated Topics in Category](https://meta.discourse.org/t/gated-topics-in-category/225454) 这个主题组件测试了它，结果一样。如果语言相同，它将返回原始文本 `en.yml`，即使你在管理后台的主题翻译部分覆盖了它。这可能也取决于 Discourse 的默认语言。🤔 我的网站默认语言是匈牙利语。

站点设置 🔽

 ![Screenshot 2022-05-12 at 15.57.20](https://global.discourse-cdn.com/meta/original/4X/9/4/a/94ae959b42defa6e245d13f9117f740cfce34442.png)

我将主题翻译覆盖为匈牙利语 🔽

 ![Screenshot 2022-05-12 at 15.59.55](https://global.discourse-cdn.com/meta/original/4X/c/f/2/cf2f74c85326cf01fdfc5c28400f664bd9fc885c.png)

如果我将 Chrome 的语言部分设置为英语（美国）

 ![Screenshot 2022-05-12 at 16.02.57](https://global.discourse-cdn.com/meta/original/4X/9/d/e/9de1e9151f7fc52b6c2ecefd1d7a64f34d38e890.png)

它将使用默认的 `en.yml` 文本。

 ![Screenshot 2022-05-12 at 16.04.20](https://global.discourse-cdn.com/meta/original/4X/d/3/9/d39b3caf76245e3ed91b2bf436848dc84651e40d.png)

但是，如果我将其更改为其他语言，例如英语（英国）

 ![Screenshot 2022-05-12 at 16.05.33](https://global.discourse-cdn.com/meta/original/4X/9/d/7/9d70faaef5110d8194fd27a080befccc3344c009.png)

这将使用我添加的自定义文本。

 ![Screenshot 2022-05-12 at 16.06.17](https://global.discourse-cdn.com/meta/original/4X/a/4/8/a485605ecdad6478f626399ff819a64c0f616128.png)

我认为在你的网站上也会发生类似的事情 🙂

你觉得怎么样 @JammyDodger？ 🙂

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2022年五月12日 14:16 UTC](https://meta.discourse.org/t/theme-translation-overrides-only-apply-to-the-administrators-language/226870/2 "2022-05-12T14:16:40Z")

</div>

如果你认为这可能是个 bug，@Don，我很乐意把它移到 #Contribute > Bug 频道，看看能不能找几个人来复现它。👍

---

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [2022年五月12日 14:18 UTC](https://meta.discourse.org/t/theme-translation-overrides-only-apply-to-the-administrators-language/226870/3 "2022-05-12T14:18:45Z")

</div>

谢谢！ 🙂 是的，我认为这可能是一种 bug。 🤔

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2022年五月12日 14:23 UTC](https://meta.discourse.org/t/theme-translation-overrides-only-apply-to-the-administrators-language/226870/4 "2022-05-12T14:23:43Z")

</div>

完成。👍 不过可能需要一个更好的标题。🙂

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2022年五月12日 14:42 UTC](https://meta.discourse.org/t/theme-translation-overrides-only-apply-to-the-administrators-language/226870/5 "2022-05-12T14:42:36Z")

</div>

我认为，当您作为管理员覆盖主题翻译时，它只会覆盖 **您在进行编辑时所使用的语言** 的翻译。覆盖不会跨越到其他语言。这与您看到的情况一致吗？

绝大多数论坛都使用默认配置，该配置不允许用户更改其语言，因此不会注意到此问题。

这是我们意识到的一个限制，但目前还没有改进它的时间表。理想情况下，我们将使其与 `/admin/customize/text` 的工作方式相同，这样您就可以为每种语言设置覆盖。当然，#pr-welcome

---

<div class="post-metadata">

### Author: ![davidkingham](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/davidkingham/32/119528_2.png) [@davidkingham](https://meta.discourse.org/u/davidkingham)
#### Post date: [2022年五月12日 20:23 UTC](https://meta.discourse.org/t/theme-translation-overrides-only-apply-to-the-administrators-language/226870/7 "2022-05-12T20:23:30Z")

</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: [2025年五月9日 07:56 UTC](https://meta.discourse.org/t/theme-translation-overrides-only-apply-to-the-administrators-language/226870/8 "2025-05-09T07:56:20Z")

</div>

> [@david](#):
>
> 这是我们已知的一个限制，但目前还没有改进它的时间表。理想情况下，我们将使其与 /admin/customize/text 的工作方式相同，这样您就可以为每种语言设置覆盖。

我认为这已经在

> <https://github.com/discourse/discourse/pull/26150>
>
> \## Why this change?
> 
> In the current Discourse theme admin UI, admins are limi…ted to editing the label in their own language only. This PR changes that.
> 
> \<details\>\<summary\>Changes\</summary\>
> 
> \- Add \`ComboBox\` in \`admin-customize-theme-show.js\` with \`availableLocales\` based on \`admin-site-text-index.js\`
> \- Add \`locale\` property to request
> \- Add check in update\_translations method to check \`locale\` property
> 
> \</details\>
> 
> \### TODO:
> \- \[x\] Tests ( would love some input on that, what would be a good test for the changes that I've made, examples )
> \- \[x\] fetching translations for the selected language; without it, the Admin might get lost. I thought of adding a get method \[here\](https://github.com/Grubba27/discourse/blob/aa30541a11b71ab0dc0f1c995ba9767f1a6e3ff9/config/routes.rb#L232-L234) to get translations -\> \` get "translations/:key" =\> "themes#translations"\`)
> 
> 
> 
> 
> \## Demo
> 
> https://github.com/discourse/discourse/assets/70247653/6849fdfb-761b-4d26-9986-23880e49a472

中实现了。

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2025年五月15日 00:36 UTC](https://meta.discourse.org/t/theme-translation-overrides-only-apply-to-the-administrators-language/226870/9 "2025-05-15T00:36:37Z")

</div>


