Globally replace translations

:information_source: Summary This plugin allows you to globally replace certain words in the translation
:hammer_and_wrench: Repository Link https://github.com/Lhcfl/replace-translations-global
:open_book: Install Guide How to install plugins in Discourse

Features

Literally, replace all occurrences of a word with another word

For example, replace “Topic” with “Nya”:

Configuration

I believe its settings are self-explanatory :slightly_smiling_face:

Note that translations are cached and changing them takes time. You can do this to force update:

sudo ./launcher enter app
rm -rf tmp
10 Likes

这个可以平替官方的自定义文本吗?

这是我目前遇到的问题,我无法批量修改那些键值!

或者说 @Lhc_fl 你有更好的方法?

这个插件就是用来批量替换翻译的啊。只不过由于缓存原因,你替换完可能还得要rebuild才能生效

我的意思是没有discourse官方提供的批量修改方法吗?
例如导出yaml文件,通过vscode来替换?

没有这样的方法,只能一个个改

那您的工具确实是非常棒的!

每一次更改都需要./launcher rebuild app
手动重建吗?
sudo ./launcher enter app
rm -rf tmp
我没有发现作用

先试试(删了tmp后) ./launcher restart app?

我是在开发环境下删的tmp,可能这里自动应用了

不行就rebuild。可能语言文件是预先编译好的,这个插件原理是干预了读语言yml的函数,它只会在第一次加载的时候跑一遍

Just a reminder that including an English translation makes it much easier for others to follow along, :pray:

3 Likes

刚刚尝试了一下,会oops,还是重建吧比较稳定