# "translation missing" being delivered via email

**URL:** https://meta.discourse.org/t/translation-missing-being-delivered-via-email/60667
**Category:** Bug
**Created:** [2017年四月9日 05:50 UTC](https://meta.discourse.org/t/translation-missing-being-delivered-via-email/60667 "2017-04-09T05:50:11Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![niemeyer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/niemeyer/32/120325_2.png) [@niemeyer](https://meta.discourse.org/u/niemeyer)
#### Post date: [2017年四月9日 05:50 UTC](https://meta.discourse.org/t/translation-missing-being-delivered-via-email/60667/1 "2017-04-09T05:50:11Z")

</div>

An email with this subject got delivered to users on today’s digest, on 1.8.0.beta9:

```plaintext
translation missing: pt_BR.user_notifications.digest.subject_template

```

This message was originally indeed not translated (was sent as “[%{site\_name}] Summary”), and I then properly translated it by hand by customizing in the respective settings tab. String appeared fine, but the actual message was sent with the above instead.

Seems like some kind of issue with that context specifically. Customizing other messages showing up in the UI itself seems to have worked fine.

---

<div class="post-metadata">

### Author: ![Celil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/celil/32/164412_2.png) [@Celil](https://meta.discourse.org/u/Celil)
#### Post date: [2017年四月10日 19:54 UTC](https://meta.discourse.org/t/translation-missing-being-delivered-via-email/60667/3 "2017-04-10T19:54:31Z")

</div>

Its same with me “translation missing: tr\_TR.user\_notifications.digest.subject\_template”

![](https://global.discourse-cdn.com/meta/original/3X/d/7/d76f03d2a04b3000513751e90d33496d3b4efa3c.png)

 ![](https://global.discourse-cdn.com/meta/original/3X/b/4/b4f8042ccf0a4562aba48cbc9c26ded996c87af6.png)

---

<div class="post-metadata">

### Author: ![niemeyer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/niemeyer/32/120325_2.png) [@niemeyer](https://meta.discourse.org/u/niemeyer)
#### Post date: [2017年四月11日 03:39 UTC](https://meta.discourse.org/t/translation-missing-being-delivered-via-email/60667/4 "2017-04-11T03:39:13Z")

</div>

Thanks for confirming @Celil. Clearly there’s something wrong happening with translations there.

More details about the behavior:

There _is already_ a translation in place for the string:

- ![](https://global.discourse-cdn.com/meta/original/3X/7/3/730e58212e536eb710a1c0da178fc4a5de767bd4.png)

Despite that, the email arrives untranslated:

- ![](https://global.discourse-cdn.com/meta/original/3X/6/e/6e726cd99fa8013833ed1d0c37c55a81d94cd541.png)

If the string is manually _re-translated_ the error shows up as the email subject:

- ![](https://global.discourse-cdn.com/meta/original/3X/9/b/9b7e41a527bfcc7b1f4eafd4e40d1ece372a4d3c.png)

---

<div class="post-metadata">

### Author: ![jhnwsk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jhnwsk/32/119635_2.png) [@jhnwsk](https://meta.discourse.org/u/jhnwsk)
#### Post date: [2017年四月12日 20:50 UTC](https://meta.discourse.org/t/translation-missing-being-delivered-via-email/60667/5 "2017-04-12T20:50:36Z")

</div>

Same thing happens to me but only if I use _%{site\_name}_ in the translation. The problem seems to be the misleading default translation. If you instead use _%{email\_prefix} Your translation_ it will work the way you want it to.

I am looking at the code for the first time, but if [this](https://github.com/discourse/discourse/blob/2916b4566645d5cf3e09d06b9b432ccc1979e14d/app/mailers/user_notifications.rb#L171) does what I think it does that means SiteSettings.title is provided to the translation as ‘email\_prefix’ because of [customizable email branding settings](https://github.com/discourse/discourse/blob/2916b4566645d5cf3e09d06b9b432ccc1979e14d/app/mailers/user_notifications.rb#L482).

I’m not really sure where the misleading default comes from because, in the case of my language at least, [there is no default provided](https://github.com/jhnwsk/discourse/blob/master/config/locales/server.pl_PL.yml#L1821) and the default for english uses _email\_prefix_.

---

<div class="post-metadata">

### Author: ![niemeyer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/niemeyer/32/120325_2.png) [@niemeyer](https://meta.discourse.org/u/niemeyer)
#### Post date: [2017年四月12日 23:54 UTC](https://meta.discourse.org/t/translation-missing-being-delivered-via-email/60667/6 "2017-04-12T23:54:58Z")

</div>

That’s a great hint, thanks!

I bet the main logic and default sentence was changed when the email\_prefix was introduced, and the pre-existing translations were left behind.

Trying your suggestion now.

---

<div class="post-metadata">

### Author: ![niemeyer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/niemeyer/32/120325_2.png) [@niemeyer](https://meta.discourse.org/u/niemeyer)
#### Post date: [2017年四月17日 14:04 UTC](https://meta.discourse.org/t/translation-missing-being-delivered-via-email/60667/7 "2017-04-17T14:04:54Z")

</div>

Confirmed, it does work with %{email\_prefix}, so the confusing bug is indeed the incorrect and misleading translation.

Might also be worth improving the error message so people are guided towards the right solution.

---

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [2017年四月27日 16:10 UTC](https://meta.discourse.org/t/translation-missing-being-delivered-via-email/60667/8 "2017-04-27T16:10:24Z")

</div>

this string has also caused the same problem in our case:

> %{topic\_excerpt}

---

<div class="post-metadata">

### Author: ![Celil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/celil/32/164412_2.png) [@Celil](https://meta.discourse.org/u/Celil)
#### Post date: [2017年五月2日 18:36 UTC](https://meta.discourse.org/t/translation-missing-being-delivered-via-email/60667/9 "2017-05-02T18:36:16Z")

</div>

Hello. It’s still same

translation missing: tr\_TR.

user\_notifications.mailing\_list.why

user\_notifications.mailing\_list.subject\_template

 ![](https://global.discourse-cdn.com/meta/original/3X/4/d/4d8b08cc5cf6fa6962079489223d0e2b7fe373e7.png)

 ![](https://global.discourse-cdn.com/meta/original/3X/6/1/61db9b6d51f0ac20f304494ced04ef92fd26ecda.png)

 ![](https://global.discourse-cdn.com/meta/original/3X/d/2/d2cfd882e5c59764c25ba529d65fc61ec3ee9c26.png)

---

<div class="post-metadata">

### Author: ![Celil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/celil/32/164412_2.png) [@Celil](https://meta.discourse.org/u/Celil)
#### Post date: [2017年五月6日 19:49 UTC](https://meta.discourse.org/t/translation-missing-being-delivered-via-email/60667/10 "2017-05-06T19:49:33Z")

</div>

@codinghorror can you help me for this problem?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2017年五月6日 20:05 UTC](https://meta.discourse.org/t/translation-missing-being-delivered-via-email/60667/11 "2017-05-06T20:05:44Z")

</div>

I suspect the issue you’re having is because you’ve changed the variables in the translation strings. For example, for the subject template, the English translation is

```plaintext
[%{email_prefix}] Summary for %{date}

```

Therefore in any translation you can only use the `email_prefix` and `date` variables. I believe you must actually use both of them for it to work.

In your subject\_template, you’ve put `site_name`, which won’t work.

---

<div class="post-metadata">

### Author: ![Celil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/celil/32/164412_2.png) [@Celil](https://meta.discourse.org/u/Celil)
#### Post date: [2017年五月9日 11:50 UTC](https://meta.discourse.org/t/translation-missing-being-delivered-via-email/60667/12 "2017-05-09T11:50:23Z")

</div>

thank you. I will try.

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [2017年五月10日 09:11 UTC](https://meta.discourse.org/t/translation-missing-being-delivered-via-email/60667/13 "2017-05-10T09:11:52Z")

</div>

Since it is rather easy to break custom text (in the sense that it will fail to render due to missing translation), it would be great if there could be a security mechanism that prevents emails from being sent out if they contain `translation missing:` and instead send an error message to the site admin?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2017年五月10日 09:19 UTC](https://meta.discourse.org/t/translation-missing-being-delivered-via-email/60667/14 "2017-05-10T09:19:16Z")

</div>

This would be great. Obviously with email it’s super important, but I wonder if the same thing could also be done across the site. It’s quite hard to check every single translation, and no way to do it automatically AFAIK?

Maybe a “failed translations” tab on the logs section of the admin screen? Ideally would contain errors from both the JS I18N and the ruby I18N

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2017年十一月26日 02:47 UTC](https://meta.discourse.org/t/translation-missing-being-delivered-via-email/60667/15 "2017-11-26T02:47:53Z")

</div>


