Localization string in E-Mail template subject field

Andriy B asked on August 29, 2018 09:39

I have the issue with localization string in the E-Mail template subject field. I tried different ways, but the subject contains english version only instead of its localized version.

The options I tried are: {%GetResourceString("membership.passwreqsubject", "cz-CS")#%} {%GetResourceString("membership.passwreqsubject")#%} {$ membership.passwreqsubject $}

The key exists in the Localization module, in the CMS.resx and CMS.cs-CZ.resx. Default locale is Czech Republic (cs-CZ) and all localizations except the Subject field works perfectly.

Another issue with E-Mail template subject field is: I'm trying to configure my e-mail template (Applications->Development->Email Templates) in Kentico and faced with encoding issue with e-mail subject field. For example, if the e-mail template subject field contains the following text with the macro:

Přijatá objednávka číslo {%HTMLEncode(Order.OrderInvoiceNumber) #%} I receive it as P?ijat? objedn?vka ??slo 3019

As you can see, the subject doesn't encoded, however, I see it in Kentico back-end without a question marks. I have no idea, how to fix it.

Pease help. Thank you in advance.

Recent Answers


Arun Kumar answered on August 29, 2018 11:23 (last edited on December 10, 2019 02:31)

It seems like you are using wrong culture code for Czech Republic. It should be cs-CZ not cz-CS. Try with cs-CZ

{%GetResourceString("membership.passwreqsubject", "cs-CZ")|(identity)GlobalAdministrator%} 
0 votesVote for this answer Mark as a Correct answer

Andriy B answered on August 29, 2018 14:17

@Arun Kumar, thank you, it works. Didn't realize the locale name is wrong. However, I wondering, why I cannot easily use the localization string {$ membership.passwreqsubject $} which should do the same thing, as per documentation? Why the default locale used instead of website default locale?

Also, the second issue - I still getting the email with wrong subject, "??dost o zm?nu hesla" instead of "Žádost o změnu hesla". Perhaps, you can give me a suggestion, how to fix it?

0 votesVote for this answer Mark as a Correct answer

Arun Kumar answered on August 29, 2018 14:22

Have you checked the Email encoding settings? You can follow this link if did not set that already.

0 votesVote for this answer Mark as a Correct answer

Andriy B answered on August 29, 2018 14:37

Yes, it was the first thing I checked. I have utf-8 value for the encoding, and html for the email format settings. In addition, I have the Default Content Culture and the Visitor Culture for the website set to Czech - Czech Republic. The only issue I have for the moment is e-mail template subject field localization - for the extended characters only, it means the subject doesn't encoded to utf-8:

As I see in the raw email, the subject field doesn't contain ?utf-8? prefix following with the text encoded (for example, Subject: P?ijat? objedn?vka ??slo 3021). I assume it should be something like the output of php-code example '=?utf-8?B?'.base64_encode($subject).'?='

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.