"translation missing" error after changing text content

(Christoph) #1

I edited discourse_narrative_bot.timeout.message under admin/customize/site_texts and thought that was a straight forward and simple job, but either I did something wrong or there is a bug because the discobot no longer displays its timeout message but says instead translation missing: en.discourse_narrative_bot.timeout.message

If this is not a bug, my interpretation is that it is not really missing a translation (since I’m using only one locale and that is the english one) but that it does not recognize the text I edited as legitimate for some reason. Is there something else I need to do to get this working? There are no special characters in my text except for %{site_name}, a link, a dash, two ", two **

When I revert back to the default message text, it works again. Is there a character limit or something, @tgxworld?

Show indicator when a default text content element has been updated?
(Alan Tan) #2

Did you happen to remove either %{username} or %{discobot_username}? Those are special variables that we inject and you can’t add new variables.

(Christoph) #3

aha! no, I didn’t remove any of these variables but I did add %{site_name}. So are you saying that whatever customization I make on discobot messages, I cannot remove any of the variables in the default text and I cannot add any other variable that is not in the default text? Or is this even so with all Text Content snippets?

(Régis Hanol) #4

While there is no way adding a variable can work (how is the code supposed to know what to replace it with? ;)) I think being able to remove variables might be worth supporting. At the very least, the error message should be improved to let the user know they’re missing variables.

(Christoph) #6

Okay, so just to understand how this works because I am not familiar with the code: are these variables not global variables? Or at least global in all machine generated text? You seem to be implying that, at least in discobot, each variable is re-invented for each text-snippet rather than having a pool of variables that is valid at least for all discobot messages and that can be drawn on when composing a snippet. Is that so?

(Régis Hanol) #7

Every time we use a translatable text in the application, we do something like


When there are variables, we do something like

I18n.t("with_variables", { variable_1: "foo", variable_2: "bar" })

So, no global pool of variables available. Just the ones required for that specific text :wink:

(Christoph) #8

Interestingly, this means that the same word can be translated differently in different contexts, right?

(Régis Hanol) #9

Yes, it all depends on what the developer used. I am open to fix any inconsistencies though.

(Christoph) #10

I think it would help a great deal if, as you suggested, the user could be alerted to the limitations that exist in editing those snippets. It would safe people a lot of time…

But I am still trying to understand whether what you are saying is specific to the discobot plugin or whether these limitations exist for all editable Text Content snippets. In the latter case, it would be a task for the core developers to somehow alert the user.

(Régis Hanol) #11

They are not limited to discobot. They exist for all editable text.