Can you override the locale via theme files?

I want to change some placeholder text, and I want it do via locale files, so there any way to do?

I have tried using by creating config/locales/client.en.yml, previously there was not those files present in themes, I also tried using locales/en.yml, but none of these works.

I think I can do this via admin settings → text and change value from there, but I want to achieve that from discourse theme files.

So is there any working method to achieve this?

Yes, you can.

An example:

I18n.translations[I18n.currentLocale()].js.composer.reply = "ylper";

2 Likes

Can we achieve that from locale yml files ?

I don’t know, I haven’t found any example of this yet. (maybe there are too few theme components I’ve looked at)

Hi :slight_smile:

Why?

If you change Discourse’s files, they will be overwritten each time you update it.

You can combine these two approaches, so something like:

I18n.translations[I18n.currentLocale()].js.composer.reply = I18n.t(themePrefix("my_translation_key"));

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.