Any way to customize message for "New" and "Unread" when nothing appears?


(Jesse Perry) #1

I have the defaults on my Discourse changed for what new users settings are for what’s considered New and what they track (so what’s considered Unread).

So the descriptions on /new and /unread when there are no topics or posts listed do not represent what are the actual defaults are.

Is there a preferable way to change this text on my installation?


Customize all text in Discourse
(Jeff Atwood) #2

No. Arbitrary override of all strings has been requested many, many times but is technically hard.

You could create a whole new localization, that is about it.


(Mittineague) #3

Would not hacking the Core and doing so after every upgrade be an option?

I know I’d rather not, but if desperation leads to desperate measures.


(Jesse Perry) #4

Thank you.

I implemented the ugly, but workable method I found somewhere on here of replacing text via jQuery on load of specific page:

<script>
    Discourse.Route.reopen({
        activate: function() {
            this._super();
            Em.run.next(function(){
            if(window.location.href === "https://DISCOURSE_SITE/new") {
              $('.education').html('NEW_TEXT_AS_HTML');
            }
            });
        }
    });

</script>

(Jeff Atwood) #5

I believe there is also a plugin somewhere that allows text override. We may want to “adopt” this plugin since it may be a while before we can get to this otherwise.


(Jesse Perry) #6

@codinghorror I believe you’re referring to this? GitHub - lidel/discourse-locale-override: Simple hack to override official translations files in Discourse and persist them between Docker rebuilds.

I was contemplating that, but was too much for the simple change I needed here.


(Mittineague) #7

I’m confused, If it is “simple” why is it “too much” ?


(Allen - Watchman Monitoring) #8

This is another example of a server.xx.yml text override:


(Sam Saffron) #9

Add a site customisation, with the following in in </body>

<script>
    I18n.translations.en.js.topics.none.educate.new = "I LOVE <b>WAFFLES</b><br><br>";
</script>

Eg:


(Erlend Sogge Heggen) #10

Customizing all text on Discourse is now a fully supported feature:


(Erlend Sogge Heggen) #11

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