<p>First, we'll be adding native support for localization in Craft 3. This is a bit trickier in Craft 2 right now.</p>

<p>Two thoughts. You could set up 3 different emails (each managed in a different language) to be triggered off the same event. Not ideal, but an option. </p>

<p>Aside from that, Sprout Email does run the <code>subjectLine</code> field through <code>renderObjectTemplate</code> so you could use a field in whatever is triggering your event as a dynamic variable for the Subject Line.</p>

CC BY-SA 3.0
2018-04-17T14:16:20.870Z
Yes, I went with the second idea you provided. My current subject line looks like this: `{% switch object.orderLocale %}{% case 'de' %}Deine Buchungsbestätigung...{% case 'fr' %}...{% case 'en' %}...{% endswitch %}`, Not ideal, but it works so far :)
exophunk
CC BY-SA 3.0
2018-04-16T13:49:02.850Z
2018-04-17T20:14:50.330Z
2018-04-17T20:14:50.330Z
Ben Parizek
<p>I use Sprout Email on a website to send transactional email (about 15 different types).</p>

<p>The website gets now translated to 3 languages (DE/FR/EN). It is all fine, but of course, also the transactional emails need to be in three languages.</p>

<p>As Sprout Email does not really support localization, it is still somehow possible by adding 3 "Email Body" fields to the email field layout:</p>

<ul>
<li>emailBodyDe</li>
<li>emailBodyFr</li>
<li>emailBodyEn</li>
</ul>

<p>In the mail template, I can then chose which body to use. All good so far.</p>

<pre><code>{% set locale = object.locale %}
{% set emailBody = email.htmlEmailBodyDe %}
{% set emailSubject = email.subjectLine %}
{% switch locale %}
    {% case "fr" %}
        {% set emailBody = email.htmlEmailBodyDe %}
        {# ... set subject!? ... #}
    {% case "en" %}
        {% set emailBody = email.htmlEmailBodyEn %}
        {# ... set subject!? ... #}
{% endswitch %}
</code></pre>

<p>But I can't translate the subject line. There is just one fixed field in Sprout Email for that.</p>

<p>Any suggestions how I can also make the subject field multi-language?</p>

<localization><plugin-sproutemail>
Sprout Email Plugin and Multilanguage. How to translate SubjectLine?
# Sprout Email Plugin and Multilanguage. How to translate SubjectLine?

(Asked by: username_0 on 2018-04-11)

I use Sprout Email on a website to send transactional email (about 15 different types).
The website gets now translated to 3 languages (DE/FR/EN). It is all fine, but of course, also the transactional emails need to be in three languages.
As Sprout Email does not really support localization, it is still somehow possible by adding 3 "Email Body" fields to the email field layout:

emailBodyDe
emailBodyFr
emailBodyEn

In the mail template, I can then chose which body to use. All good so far.
{% set locale = object.locale %}
{% set emailBody = email.htmlEmailBodyDe %}
{% set emailSubject = email.subjectLine %}
{% switch locale %}
    {% case "fr" %}
        {% set emailBody = email.htmlEmailBodyDe %}
        {# ... set subject!? ... #}
    {% case "en" %}
        {% set emailBody = email.htmlEmailBodyEn %}
        {# ... set subject!? ... #}
{% endswitch %}

But I can't translate the subject line. There is just one fixed field in Sprout Email for that.
Any suggestions how I can also make the subject field multi-language?

**Tags:** localization, plugin-sproutemail


---

## 1 answers

### Answer by username_1 on 2018-04-16. Score: 1 | Accepted answer

First, we'll be adding native support for localization in Craft 3. This is a bit trickier in Craft 2 right now.

Two thoughts. You could set up 3 different emails (each managed in a different language) to be triggered off the same event. Not ideal, but an option.

Aside from that, Sprout Email does run the `subjectLine` field through `renderObjectTemplate` so you could use a field in whatever is triggering your event as a dynamic variable for the Subject Line.

> **Comments:**
> **username_0**: Yes, I went with the second idea you provided. My current subject line looks like this: `{% switch object.orderLocale %}{% case 'de' %}Deine Buchungsbestätigung...{% case 'fr' %}...{% case 'en' %}...{% endswitch %}`, Not ideal, but it works so far :)  

---

