Hello,
I am trying to edit my current unsubscribe page so that if people from China get to it, all the content will show up in chinese or if people in Japan go to it, everything will be in Japanese.
I know how to change the content itself and make it dynamic based on country but I'm having difficulty trying to figure out how to make the button text dynamic.
Is there a simple way to make that dynamic? I imagine it'll take some html/css code to make it happen.
Hi Stephen,
You have a few options:
- You could have different forms display based on the country of the user using segments (the most user-friendly option)
- You could set a language variable in JavaScript on your dynamic text, have a window.onload check for the variable, and use innerHTML to swap the button text (the technical but lazy option)
- You could pass the language as a hidden URL parameter in the unsubscribe link, parse the value using Forms 2.0, and use innerHTML to swap the button text (the technically correct solution)
Also, out of curiosity: for Japanese, are you using メーリングリストの登録解除 or アンサブスクライブ?
Thanks for the suggestions! I did not start translating the copy yet so I don't know which one we will be using but when I find out I'll let you know!
Stephen, further to Courtney's third point, you should check out these posts and my related code:
Re: How do I update the submit button and error message to reflect local language (i.e French)
Re: Marketo Dynamic Form Field Labels - Multiple Languages
I've just demoed the language-switching code for the NYC MUG tonight so feel free to ask any questions.
Thanks that's exactly what I was looking for!
I'm looking at the code you used and I put that in my form but I'm not seeing it dynamically changing to the other language. If I wanted to change the code to say that if a lead's country value is "Japan" then make the submit button say "アンサブスクライブ" ,how would I do that?
Here's the dictionary DIV with your Japanese submit text:
And here's how it looks on the form: http://codepen.io/figureone/pen/mJWgjE?editors=001&lang=jp-JP
Thank you for the updated code Sanford.
I'm not sure what I'm doing wrong but when I put that code in to my form using the rich text field, it just shows up as text.
Here's the code I put in:
<div id="translateMap">
{
"en-US": {
"LastName": {
"label":"Surname", "validation":"Make sure that's your real last name.", "submit":"Go"
}
},
"fr-FR":{
"FirstName":{
"label": "Prénom", "placeholder": "Victor", "submit":"Envoi"
}
},
"jp-JP": {
"FirstName":{ "submit":"アンサブスクライブ"
}
}
}
</div>
And here's what it looks like on my LP:
You put it in the HTML source view, right?
And you probably didn't include this CSS:
/* hide the last rich text div used to pass JSON translate map */
.mktoFormRow:not([data-wrapper-for]) { display: none; }
#translateMap { display: none; }
What's the actual URL you're working on?
thanks! that did the trick!
Great! Can you 'Mark as Correct'?