"translation missing" error after changing text content

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?

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

3 Likes

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?

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.

3 Likes

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?

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

I18n.t("name_of_the_string")

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:

1 Like

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

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

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.

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

3 Likes