HTML tags in plaintext digest when missing a translation

AI-generated summary

A user, Phyks, reported an issue with HTML tags in plaintext email digests when a translation is missing. The issue occurs when a server lacks a translation for a specific locale, in this case, French. The resulting email contains HTML tags, such as <span class="translation_missing" title="translation missing: fr.user_notifications.digest.unsubscribe">Unsubscribe</span>.

Phyks argued that this is a bug, as the plaintext version should not contain HTML tags, even if a translation is missing. sam initially stated that it was not a bug, but rather a missing French translation. However, Phyks and neil pointed out that the issue is not just about the missing translation, but also about the HTML tags being included in the plaintext version.

neil later discovered that the issue might have been fixed in a recent update, as the email notification path changed last year. After deleting some French translations, neil found that the text version of the digest was using English where French strings were missing, and there were no HTML tags present.

Hi,

I subscribed to digests on Discourse instances and read my emails in plaintext. Huge :+1: for having a really usable and readable plaintext version!

However, I recently discovered that some HTML tags were present in the digests when server lacks some translations. For instance, consider the unsubscribe link from the digest, translation is here, but is not available in the French locale.

Resulting email has following content in plaintext:

<span class="translation_missing" title="translation missing: fr.user_notifications.digest.unsubscribe">Unsubscribe</span>

with the unsubscribe link reference below. I would have expected it to be something like

Unsubscribe [3]

(where [3] is the reference of the unsubscribe link at the bottom of the email body).

Thanks!

1 me gusta

Not really a bug, its simply a missing french translation see: Contributing translations to Discourse

I’d disagree with the fact that it is not a bug. The root of the issue, is that there is a missing French translation, which I totally agree with.

But the issue I am reporting extend beyond the missing French translation. The true issue (in my opinion) is that if a translation is missing, plaintext emails get HTML tags in them. The span should be replaced by its content, in the plaintext version, in the case of a missing translation.

Hmm, yeah … that is somewhat odd, we usually fallback to english but not here.

1 me gusta

The fallback to English is happening, but still the span is there.

<span class="translation_missing" title="translation missing: en.user_notifications.digest.unsubscribe">Unsubscribe</span>

Notice the word “Unsubscribe” is there. My site was supposed to be French, but it’s saying that the english translation is missing too… So wrong.

ActiveSupport is trying to be helpful by adding that span, and I don’t see a way to stop it in the case that we’re not using it in HTML…

4 Me gusta

La ruta que siguen las notificaciones por correo electrónico cambió el año pasado, ¿lo que podría haber solucionado esto? Eliminé algunas traducciones en francés y puedo ver que la versión en texto del resumen está usando inglés donde faltan las cadenas en francés, y no hay ningún span HTML.

Este resumen se envía desde [Localhost][1] cuando no te hemos visto en un tiempo. Cambia [tus preferencias de correo][7] o [haz clic aquí][8] para cancelar la suscripción.

3 Me gusta