# 类别描述截断为第一段用于主要/基础语言，但不适用于本地化面板语言

**URL:** https://meta.discourse.org/t/category-description-truncates-to-first-paragraph-for-primary-base-language-but-not-for-localizations-panel-languages/406801
**Category:** Bug
**Tags:** category-banners
**Created:** [2026年七月3日 23:22 UTC](https://meta.discourse.org/t/category-description-truncates-to-first-paragraph-for-primary-base-language-but-not-for-localizations-panel-languages/406801 "2026-07-03T23:22:44Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![osan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osan/32/569599_2.png) [@osan](https://meta.discourse.org/u/osan)
#### Post date: [2026年七月3日 23:22 UTC](https://meta.discourse.org/t/category-description-truncates-to-first-paragraph-for-primary-base-language-but-not-for-localizations-panel-languages/406801/1 "2026-07-03T23:22:44Z")

</div>

当类别的“类别语言”设置为非默认语言环境（例如，在默认语言环境也是德语的站点上设置为德语）时，类别横幅会正确地将描述截断为仅第一段——这与文档指南中所述的第一段为简要摘要、后续段落用于详细说明/规则的情况相符。

然而，通过类别的 **本地化** 面板输入的_其他_语言的描述并未以相同方式截断——它们在横幅中显示完整的多段文本，包括根据 Discourse 自身的类别编辑指南明确作为“较长描述”的内容。

这导致横幅长度在视觉上因观众选择的语言而异，尽管底层保存的内容在所有语言中结构相同（相同的段落分隔符，相同的意图）。

**预期行为**

要么：

- 所有语言在横幅中均截断为第一段，其余内容仅在完整类别/关于页面中可见，或者
- 所有语言在横幅中均显示完整描述。

无论预期行为如何，同一类别的主要/基础语言和本地化面板语言的行为应保持一致。

**实际行为**

- 基础语言（德语，类别语言明确设置为德语）：横幅仅显示第一段。
- 本地化面板（英语、法语）：横幅显示整个已保存的描述，所有段落均未截断。

**重现步骤**

1. 创建一个类别。将“类别语言”（常规选项卡或本地化选项卡，具体取决于版本）设置为与站点原始工作语言不同的语言——在我们的案例中，为德语，与站点的 `default_locale` 匹配。
2. 直接在该基础字段中编写两段描述：第一段简短，第二段较长且包含更多详细信息。
3. 进入类别的本地化选项卡，添加英语和法语条目，并为每种语言粘贴等效的两段描述。
4. 以德语查看类别页面/横幅——仅显示第一段。
5. 将界面语言切换为英语或法语——横幅中显示完整两段描述。

在我们的实例上的两个独立类别中均一致重现（已附上两者的截图）。

**环境**

- 自托管 Discourse，[版本——发布前从管理员 → 关于您的站点获取；我尚未确认此信息]
- 已启用内容本地化
- 内容本地化支持的语言环境：英语、法语
- 站点默认语言环境：德语
- 两个测试类别的类别语言：德语

**附件：**

 ![image](https://global.discourse-cdn.com/meta/original/4X/8/6/9/869a4f757cd667bf347a8b6a916b706bbe0a4436.jpeg)

---

<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: [2026年七月7日 14:11 UTC](https://meta.discourse.org/t/category-description-truncates-to-first-paragraph-for-primary-base-language-but-not-for-localizations-panel-languages/406801/2 "2026-07-07T14:11:44Z")

</div>

感谢您抽出时间提交此报告！我可以确认您说得对，我们确实对翻译后的描述采用了不同的处理方式，而且这个问题不仅出现在分类横幅主题组件中，而是普遍存在。

所有语言都应遵循默认行为，仅显示第一段内容。我将在此处对翻译后的描述进行相应调整：

> <https://github.com/discourse/discourse/pull/41511>
>
> Reported here: https://meta.discourse.org/t/category-description-truncates-to-fi…rst-paragraph-for-primary-base-language-but-not-for-localizations-panel-languages/406801
> 
> In a number of places we only show the first paragraph of a category description by default, but when someone manually adds a category description translation we show the full content. This results in translated content being much longer in some places where only a single paragraph is expected (/categories pages, category headers, etc). 
> 
> This change cooks the translated description and applies the same single paragraph rule where relevant.
> 
> \`Category.first\_paragraph\_description\` has been extracted to be used in both the default and translated descriptions so the behavior remains consistent.

一旦此更改被合并，下次您更新 Discourse 时即可看到修正后的效果。
