# \`temporarily\_closed\_due\_to\_flags\` 通知未按服务器的 locale 显示

**URL:** <https://meta.discourse.org/t/temporarily-closed-due-to-flags-notice-not-in-servers-locale/381000>\
**Category:** Bug\
**Created:** [2025年八月30日 16:18 UTC](https://meta.discourse.org/t/temporarily-closed-due-to-flags-notice-not-in-servers-locale/381000 "2025-08-30T16:18:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![littleD](https://avatars.discourse-cdn.com/v4/letter/l/7bcc69/32.png) [@littleD](https://meta.discourse.org/u/littleD)\
**Post date:** [2025年八月30日 16:18 UTC](https://meta.discourse.org/t/temporarily-closed-due-to-flags-notice-not-in-servers-locale/381000/1 "2025-08-30T16:18:24Z")

</div>

**优先级/严重性** : normal

**平台** : all

**描述** : `temporarily_closed_due_to_flags` 通知未在服务器的 locale 中创建。

**重现步骤** :

1. 创建一个主题，然后
2. 让许多用户（locale 设置与服务器的 locale 不同）标记该主题的帖子。然后
3. 由 `@system` 创建的 `temporarily_closed_due_to_flags` 通知（`en_US` locale 中的“This topic is temporarily closed for at least %{count} hour due to a large number of community flags.”）将显示为用户的 locale 而不是服务器的 locale。

这与此提交修复的问题类似。

> <https://github.com/discourse/discourse/commit/0a5376084d4315b38089f2ac26dd2ffd8f19b556>
>
> Previously it was created with the locale of the user who created the final post… in the topic

我相信可以通过更改以下代码来修复：

> <https://github.com/discourse/discourse/blob/bb6c5c9fa1793887f6ba3a3489f2ce0d7549a6e9/lib/post_action_creator.rb#L222-L229>

---

<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年八月31日 23:38 UTC](https://meta.discourse.org/t/temporarily-closed-due-to-flags-notice-not-in-servers-locale/381000/2 "2025-08-31T23:38:56Z")

</div>

是的，这是一个很好的发现，它可能是在最后一个标志的上下文中运行，而不是在服务器的本地化上下文中运行。

一个简单的：

` locale: SiteSetting.default_locale` 将解决这个问题。

我们将在未来几周内解决这个问题。

---

<div class="post-metadata">

**Author:** ![kris.kotlarek](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kris.kotlarek/32/176919_2.png) [@kris.kotlarek](https://meta.discourse.org/u/kris.kotlarek)\
**Post date:** [2025年十月13日 07:35 UTC](https://meta.discourse.org/t/temporarily-closed-due-to-flags-notice-not-in-servers-locale/381000/8 "2025-10-13T07:35:07Z")

</div>

感谢您报告此错误。它已在此 PR 中修复：

> <https://github.com/discourse/discourse/pull/34718>
>
> When a topic is automatically closed due to flags, the system message should alw…ays use the site's default locale rather than the current user's locale to ensure consistency for all users viewing the topic.
> 
> https://meta.discourse.org/t/temporarily-closed-due-to-flags-notice-not-in-servers-locale/381000/1

---

<div class="post-metadata">

**Author:** ![kris.kotlarek](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kris.kotlarek/32/176919_2.png) [@kris.kotlarek](https://meta.discourse.org/u/kris.kotlarek)\
**Post date:** [2025年十月17日 21:00 UTC](https://meta.discourse.org/t/temporarily-closed-due-to-flags-notice-not-in-servers-locale/381000/11 "2025-10-17T21:00:41Z")

</div>

此主题已在 4 天后自动关闭。不再允许回复。
