自定义 Discourse 中的文本

:bookmark: This is a guide for customizing text in Discourse via the admin interface, enabling changes to various UI elements.

:person_raising_hand: Required user level: Administrator

In Discourse, you can customize all of the text via the admin interface. This can be useful for tailoring the user experience to better fit the particular tone or branding of your community.

Summary

This guide will cover:

  • Accessing the text customization interface
  • Editing text strings
  • Identifying translation keys

Accessing the text customization interface

To customize the text in Discourse, navigate to the text customization page:

  1. Go to Admin.
  2. Search for site text in the sidebar search.
    OR
    Enter the URL of the screen directly https://discourse.example.com/admin/customize/site_texts

You will be presented with a page where you can search for specific text strings to edit.

Editing text strings

To edit a text string:

  1. Search for the text you want to customize.
  2. Click Edit.
  3. Enter the new value.

For example, you might want to personalize the “About Your Site” link:

After making changes and refreshing the page, the text will be updated:

Identifying translation keys

If you need help identifying the strings to translate, refer to this guide: Find a translation key with verbose localization

FAQs

Can I customize all text in Discourse including system messages?
Yes, you can customize almost all text strings, including system messages, notifications, and UI elements.

Do I need to refresh the page to see changes?
Yes, after making changes, you’ll need to refresh the page for the updated text to appear.

Last edited by @Moin 2024-07-22T06:11:29Z

Check documentPerform check on document:
74 个赞

有没有办法为自定义文本添加超链接?

是的,您可以使用 markdown 链接,例如:
这是一个链接到谷歌!
(原始格式是):

这是一个[链接](https://google.com)到谷歌!
1 个赞

感谢 @Firepup650。我正在尝试更新其中一封电子邮件中的页脚文本,当我剪切并粘贴您的行时,它会显示如下。也许这些 markdown 链接在电子邮件中不起作用?

我试图更新 user_notifications.chat_summary.unsubscribe_no_link

嗯。也许电子邮件模板不同。您能尝试使用原始 HTML 吗?

这是一个指向 Google 的链接
(原始格式是):

这是一个指向 Google 的<a href="https://google.com/">链接</a>!
1 个赞

那奏效了!谢谢你。

1 个赞

我想知道在新管理员侧边栏出现之前,情况是否仍然如此…… :upside_down_face:

我们需要批量修改这些记录

有一个 Globally replace translations 用于在所有地方替换单词。

谢谢,这个作者还是来自我的国家!!

我尝试更改文本,但“保存更改”按钮呈灰色。

我在我们的“需要登录”欢迎页面上应用此功能时遇到问题。它似乎在一个 div 中,但链接似乎不可点击,正如预期的那样。我该如何将链接的目标转义到当前窗口?(右键单击并选择“在新标签页中打开此链接…”当然可以。)

:white_check_mark: 已修复:
我使用了一个指向 target=“_blank” 的锚点 :slight_smile: