pqMMA
(Chris Palmquist)
2021 年2 月 25 日 02:19
1
I know that Discourse lets use now change text almost everyone on the site through the admin panel, but is there a way to do something like find and replace all?
I know categories and topics are fundamental to how Discourse was built, but what if I wanted to match the experience of the forum I’m migrated to and instead wanted to use ‘Forums’ to replace ‘Categories’ and ‘Threads’ to replace to ‘Topics’. ?
Falco
(Falco)
2021 年2 月 25 日 02:48
3
There is no easy way to do a bulk translation. It would also be a little confusing because the URLs would not reflect the changes.
2 个赞
pfaffman
(Jay Pfaffman)
2021 年2 月 25 日 02:49
4
I think that you could do it with a plugin that replaced the locale. I do think it would be confusing for people.
我也想做类似的事情。如果能在标准套餐或商务套餐中实现这一点,那就太好了!
pfaffman
(Jay Pfaffman)
2022 年5 月 23 日 16:33
8
如果您是自托管,会稍微容易一些。我可能会通过 rails 控制台来完成,不过插件也是一种方法。
您想替换什么?
1 个赞
我想将文本“Topic”替换为“Thread”。有命令可以做到吗?
pfaffman
(Jay Pfaffman)
2022 年5 月 23 日 17:05
11
我找不到简单的方法来做到这一点。我认为最简单的方法是创建一个插件,覆盖所有你想更改的实例,这样你就可以在文本编辑器中进行更改。这可能需要我几个小时。几年前,可能需要 5 个小时?你可以从 GitHub - discourse/discourse-plugin-skeleton: Template for Discourse plugins 开始,将 config/locales/client.en.yml 复制到骨架的 config/locales 中,删除不想更改的字符串,并编辑你想更改的字符串。不过,一定有一种方法可以让 rails 给你所有的字符串(哦,这里有一个 https://stackoverflow.com/questions/37842701/how-to-list-all-available-locale-keys-in-rails),然后你可以遍历所有字符串,获取字符串并为你想更改的字符串插入 TranslationOverride,但插件路线可能更好,因为你想手动调整内容并查看你正在更改的内容)。
不过,尝试将“topic”更改为“thread”是个坏主意。这不会带来任何好处。Discourse 没有线程讨论,这就是它们被称为 topic 的原因。而且很少会有包含“topic”的新字符串被添加,但它们可能会随着时间的推移悄悄出现。
好的,我今天晚些时候会试试。我想这对于一件简单的事情来说可能太费力了。我懂一些 JS 和 Python,但从没接触过 Ruby。
谢谢你的帮助!
1 个赞
pfaffman
(Jay Pfaffman)
2022 年5 月 23 日 17:49
13
确实如此。我建议您将时间花在任何您认为能让您的论坛成功的其他事情上。
2 个赞