APIs & Integrations

LCHAMPOT
Participant

Adapt the language property on email

SOLVE

Hi all !
I create a Trial End Date property and add it on a module for my emails campaings. It’s not possible to translate the “Trial Days Left” property in the emails (jours > days). It's translated in the contact record, but that doesn’t apply in emails because it’s not a default property.

 

As its a module, can i edit the code to translate the property ? 

Here is the code : 

 

<div style="text-align: left; margin: 10px 20px;">
<span style="display: inline-block; background-color: #F3F0FF; color: #4E3A99; padding: 6px 12px; border-radius: 20px; font-size: 14px; font-weight: 500; font-family: Helvetica, Arial, sans-serif;">
<b>{{ contact.trial_days_left | default("Few") }}</b> / days left before your free trial ends
</span>
</div>

 

 Thanks 🙂

0 Upvotes
1 Accepted solution
evaldas
Solution
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Adapt the language property on email

SOLVE

Oh, I see now!

 

In this case what you can do is use a HubL replace filter to translate that manually.

 

First you will need to make sure to turn on the "Use module for programmable email" feature

evaldas_0-1747667911185.png

 

If you are using a a drag and drop template, you don't need to do this but if you are using a custom-coded email template, you will also need to add "isEnabledForEmailV3Rendering: true" a the top of your template file. 

 

evaldas_1-1747668064680.png

https://knowledge.hubspot.com/marketing-email/create-programmable-emails

 

Once the module is turned on for programmable email, you can use the following code to manually translate your property in the email:

 

{% set days_remaining = contact.trial_days_left %}
{{ days_remaining|replace('jours', 'days') }}

 

Let me know if it works properly for you 🙂

 

 

 

 

✔️ Did this post help answer your query? Help the community by marking it as a solution.

View solution in original post

7 Replies 7
LCHAMPOT
Participant

Adapt the language property on email

SOLVE

Hi @evaldas ! 

I want to display the value in my email, the property is a calculated property of type Time between today and a date, with:

  • Start date = Today's date

  • End date = Trial End Date (a custom date property)

As I created it with my french portal, it's diplay "jours" in french on both emails like they translate only default properties. I was wondering if I ask can translate it in the module. They tell me to ask a developper.

Thanks so much.

evaldas
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Adapt the language property on email

SOLVE

Thank you for clarifying. 

 

You can actually use custom properties in emails - in your case, you might just need to update it to a personalization token.

 

So in your module, instead of:

 

{{ contact.trial_days_left | default("Few") }}


try using:

 

{{ personalization_token('contact.trial_days_left', 'Few') }}

 

Let me know whether this worked for you 🙂

✔️ Did this post help answer your query? Help the community by marking it as a solution.

LCHAMPOT
Participant

Adapt the language property on email

SOLVE
Hello 🙂 !

Thanks! I tried using it, but the email still displays *"jours"* instead of
*"days". *The email language is correctly set to *English *and I choose a
US contact for the "display as" and send it to my french email.

Could this be related to my browser language when receiving the email?

Let me know if there's something else I should check 🙂
0 Upvotes
evaldas
Solution
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Adapt the language property on email

SOLVE

Oh, I see now!

 

In this case what you can do is use a HubL replace filter to translate that manually.

 

First you will need to make sure to turn on the "Use module for programmable email" feature

evaldas_0-1747667911185.png

 

If you are using a a drag and drop template, you don't need to do this but if you are using a custom-coded email template, you will also need to add "isEnabledForEmailV3Rendering: true" a the top of your template file. 

 

evaldas_1-1747668064680.png

https://knowledge.hubspot.com/marketing-email/create-programmable-emails

 

Once the module is turned on for programmable email, you can use the following code to manually translate your property in the email:

 

{% set days_remaining = contact.trial_days_left %}
{{ days_remaining|replace('jours', 'days') }}

 

Let me know if it works properly for you 🙂

 

 

 

 

✔️ Did this post help answer your query? Help the community by marking it as a solution.

LCHAMPOT
Participant

Adapt the language property on email

SOLVE

Oh wow, its works !!! Huge thanks 🤗

evaldas
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Adapt the language property on email

SOLVE

Awesome! Thank you for confirming and glad to hear we were able to solve this 😌

✔️ Did this post help answer your query? Help the community by marking it as a solution.

0 Upvotes
evaldas
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Adapt the language property on email

SOLVE

Hi @LCHAMPOT,

 

When you say you want to translate the property, do you mean you want to convert the value or simply display the value in the email? 

 

Also, what is the property type of "trial_days_left"? (i.e. text, number, calculation, etc.)

✔️ Did this post help answer your query? Help the community by marking it as a solution.