Bulk replacement in translated strings?

AI-generated summary

The discussion is about bulk replacing translated strings in Discourse. pqMMA wants to replace “Categories” with “Forums” and “Topics” with “Threads” for a consistent experience after migrating from another forum.

omarfilip provides a link to a Meta Discourse topic about replacing a string in all posts, but Falco notes that there is no easy way to do a bulk translation and it could be confusing due to URL inconsistencies. pfaffman suggests creating a plugin to replace the locale, but notes that it could be confusing for users.

Others, including Nitin_Iyer and codergautam, express interest in implementing this feature. pfaffman explains that it’s easier to do for self-hosted Discourse instances and provides a possible approach using a plugin.

codergautam wants to replace “Topic” with “Thread” and pfaffman provides guidance on how to do it using a plugin, but advises against it due to potential issues with Discourse’s functionality. However, Lhc_fl mentions that they have written a plugin that can solve this problem, providing a link to the Meta Discourse topic.

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’. ?

Yes, see this:

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.

I think that you could do it with a plugin that replaced the locale. I do think it would be confusing for people.

I’m interested in doing something like this as well. If there’s a way to implement this while on a Standard or Business plan that would be great!

Me too, I’m selfhosting though

It’s somewhat easier if you’re self hosting. I’d probaby do it at the rails console, though a plugin would be another way to do it.

What do you want to replace?

I want to replace the text “Topic” to “Thread”. Is there a command to do it?

I don’t see an easy way to do it. I think the easiest would be a plugin that overrides all of the instances you want to change, so you could do it in a text editor. It would probably take me a couple of hours. A few years ago, it might have been 5? You’d start with GitHub - discourse/discourse-plugin-skeleton: Template for Discourse plugins · GitHub copy config/locales/client.en.yml into config/locales in the skeleton, delete the strings you don’t want to change and edit those that you want to change. Though there must be a way to get rails to give you all of the strings (oh, here’s this https://stackoverflow.com/questions/37842701/how-to-list-all-available-locale-keys-in-rails, and then you could loop through them all, get the string and insert a TranslationOverride for those you want to change, but the plugin route is probably better, as you’ll want to tweak stuff by hand and see what it is that you’re changing)

Trying to change “topic” to “thread” is a bad idea, though. No good can come from it. And Discourse doesn’t have threaded discussion, which is why they are called topics. And there won’t often be new strings added that contain “topic” but they could sneak in over time.

Alright, I will try it later today. I guess it might be too much work for a simple thing. I know some JS and Python but never touched ruby.

Thanks for your help!

Indeed. I’d recommend that you spend your time on pretty much anything else that you think will make your forum succeed.

Just a reminder: I have written a plugin that can solve this