HTML tags in plaintext digest when missing a translation

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 个赞

Not really a bug, its simply a missing french translation see: Contribute a translation 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 个赞

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 个赞

电子邮件通知的发送路径在去年发生了变化,这或许已经解决了这个问题?我删除了一些法语翻译,发现摘要的文本版本在缺少法语字符串的地方使用了英语,且没有 span HTML 标签。

此摘要由 [Localhost][1] 发送,因为我们有一段时间未收到您的访问。请更改您的 [邮件偏好设置][7],或 [点击此处][8] 取消订阅。

3 个赞