Enjoy matching translated strings and their translation keys right in the GUI


(Anton) #1

So, now you can enter the Translation Superman mode and see something like this:

What can we do with this?

  1. Match translated strings and their translation keys right in the GUI, which I hope is a good news for translators.

  2. Quickly find where a particular piece of HTML is rendered in Handlebards templates since almost every text is internationalized. This, I believe, is a good news for those who want to learn Discourse and contribute but finds it difficult to understand what is where. So you just get the translation key and find it in the Discourse codebase quickly in your favorite IDE.

This functionality is gone as soon as the Discourse tab is reloaded in your browser.

How to become the Translation Superman?

  1. For a permanent setting, go to site settings and enable verbose localization.

  2. For one-time session, enable it in console:
    From that point on when you reload the page you will get a localization session. Once you close the tab, it will go away.

  3. From now on, each time a single string is translated, 2 things will happen:
    a. The used translation key and corresponding translation options are logged in the browser console with a unique incremental number.
    b. The incremental number is appended to the translated string.

NB. So far, this only works for strings translated on client with JS, but the good news is that it covers most of the non-admin GUI.

Translation for [ru.filters.new.title.few]
Not sure how to explain as I know now what they are called - eg Topic (T19) Category (T31)
Finding the text resource id
(Sam Saffron) #2

This is now live via


To enable you have the “verbose_localization” site setting.

(Sam Saffron) pinned #3

(Anton) #4

Thank you.

Will it affect everyone? The idea was to be able to turn it ON only for a single particular person on LIVE setup.

It might be used later by admins when there is a way to override particular translation strings, which is planned to be done sooner or later considering earlier discussions here at Meta.

It does not look right to not be able to turn it on for only a single administrator who is willing to override localization. That’s why in the original commit you had to run a command in the console. The analogue could be a button for administrator, but not a side-wide setting.

(Sam Saffron) #5

We can add a method to enable it from console, should be fairly simple.

(Anton) #6

Excellent - please add such a possibility.
If it enables the feature for a single person, that would be perfect. Thank you!

(Sam Saffron) #7





In the console to enable a verbose localization session, from that point on when you reload the page you will get a localization session. Once you close the tab it will go away.

@meglio can you update the original post with updated screenshots and instructions?

(Anton) #8

Updated instructions.
Not sure why I should update the screenshot - it looks the same, does it?

(Anton) #9

When you run this command in console:


…could it return/output something like:

Verbose localization session is now ON. Please continue surfing to see translation keys in parenthesis. To turn OFF, just reload the page in your browser.

Currently it outputs undefined which may make an impression that it has not worked.

(Sam Saffron) #10

Sure. PR welcome …

(Erick Guan) #11

So let’s just return true…

(Anton) #12

Good, thank you.
Why not a more descriptive string? It gets output in console, so it would make sense.

(Erick Guan) #13

Does ‘Verbose localization session started’ work for you? Or you can file PR yourself :stuck_out_tongue:

(Zane Beckman) #14

Perhaps it should respond in the native language of whoever invoked the command :trollface:.

(Erick Guan) #15

:sweat: I think it’s a feature for advance translators, which means they know English a little bit :wink:

(foobar) #16

This is very useful. It would be even better if it was somehow linked to the ID of the string in transifex. Sometimes it’s not trivial for me to tell.

(Anton) #17

The keys that are used in Transifex can be seen in the console in front of the number, e.g.:

Translation #163: category.create, ...

Here category.create is the key in Transifex.
All you have to do is search by this key in Transifex:

(caue rego) #18

A magical transifex link would be simply awesome, indeed!

This is all mostly related to client.yml correct? Or does it apply to all other files as well? If so, it will become hard to identify from which file it comes from, I suppose.

(Gerhard Schlager) #19

It works only with keys from client.yml.

(Anton) #20

@sam , it looks as if verbose_localization_session() has stopped working. It does not display anything in the console anymore. Could you please take a look at it when you get a chance. Many thanks.