Need to Define lang="${Language}" as global variable in mkto email template | Community
Skip to main content
Suraj_Singh
Level 2
April 16, 2021
Solved

Need to Define lang="${Language}" as global variable in mkto email template

  • April 16, 2021
  • 1 reply
  • 5027 views

I'm working on the new email template and trying to create <html  lang="${Language}"> as global variable so it will used for multiple locale based on the region (eg: ja,th,ru,ko,en) per accessibility . Generally this helps to ensure that the screen reader is pronouncing words the way they were intended 

 

 

Currently its hardcored as "en" in <html section >

-----------------------------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> <head> <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"> <!--Global Variables Begin--> <meta class="mktoString" default="" id="emailTitle" mktomodulescope="false" mktoname="Email Title" /> <meta class="mktoString" default="" id="language" mktomodulescope="false" mktoname="Language" /> <!--Toggle Mobile View Meta Tags End--> <!--Other Meta Tags Begin--> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta content="width=device-width, minimal-ui, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" /> <meta name="robots" content="noindex,nofollow"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>${emailTitle}</title> <head> Container area <body> </body> </html>
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

Setting lang on the <title> and <body> elements should be more than sufficient here.

Also, the XHTML doctype seems out of place. Where is this email served with an XML MIME type? (Answer: nowhere!). EDIT: OK, I'll let this go for but haven't advised XHTML in a really long time.


Or just do it like this (yes, tested):

<meta class="mktoString" default="" id="emailLanguage" mktomodulescope="false" mktoname="Email Language" /><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="${emailLanguage}" xml:lang="${emailLanguage}" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> <head> <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"> <!--Global Variables Begin--> <meta class="mktoString" default="" id="emailTitle" mktomodulescope="false" mktoname="Email Title" /> <!--Other Meta Tags Begin--> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta content="width=device-width, minimal-ui, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" /> <meta name="robots" content="noindex,nofollow"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>${emailTitle}</title> <head> Container area <body> </body> </html>

 

 The Marketo-specific <meta> tags in a template are preprocessor tags anyway. They don't appear in the final HTML output. Like tags you might use in a tag-based templating language (PHP, CFML, etc.).

1 reply

SanfordWhiteman
Level 10
April 16, 2021

... and what happens if you attempt to make it a global string variable?

Suraj_Singh
Level 2
April 16, 2021

Generally we defined the Marketo Variables under the <head> tag post the we use these variables in the html structure<body> for declaration. but in current case its above the <head> tag and we can not defined the  variable  in that way.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="${lang}" xml:lang="${lang}" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">

 

 

SanfordWhiteman
Level 10
April 16, 2021

Please remember to use the Syntax Highlighter. (I edited your post again.)

 

My question is not theoretical, but rather what actually happens when you declare the variable in a child <meta> tag but use it in the parent <html> tag?