Add multilingual welcome note (placeholder text) in search box along with user name
[Following tip was posted as commenthere; we think, this tip deserves it's own post]
Prerequisite: Zendesk Professional, or onwards subscriptions plan
Question:What I am going to get out of this tip?
Answer:If you want to show a welcome note (f.ex. "Hi Tom, how can we help?") in search-box (see image below), and let's say you want that to show in multiple languages?
Tip shared below would allow you to have multilingual welcome-note in search-box.
Please follow steps below:
- Create Dynamic Content called "hc_search_greetings_template"
- Store a string like, "Hello %NAME%, how can we help you?" in in "hc_search_greetings_template"
- Add more variants (languages) but let's keep%NAME%in string where we want Name to appear"
- Add a span tag with data-* attribute (following line of code) in Header template (at the end, after line)
data-value="{{dc 'hc_search_greetings_template'}}"
style="display:none"> - 让我们修改我们的代码,并将其在Theme JavaScript (General > Customize Design > Edit Theme > JS)
$(document).ready(function() {
if(HelpCenter.user.role!='anonymous') {
var gtext = $("span#dc_greetings_template").data('value');
gtext = gtext.replace('%NAME%', HelpCenter.user.name);
$('#query').attr('placeholder', gtext);
}
});
Please try it, and share your feedback. I hope, it helps you. Have any questions, please get in touch.
Cheers
TeamDiziana
VisitDizianato download free and premium custom responsive ready-to-use Zendesk theme or Zendesk template or Zendeskpluginsfor Zendesk Help Center.Brandyour Zendesk Help Center, and provide fantastic self-service customer support experience.
-
You're right--it does deserve its own post.
Thanks, Team Diziana!
-
Thanks a lot! Worked as a charm!
-
Hi Karol! I'm so glad this tip worked for you! Please let us know if you need anything else. :)
-
Is this still relevant in 2022? I know there were changes to ZD so I wonder if these instructions should work or not.
I followed the instructions step by step but nothing changed.
Pleasesign into leave a comment.
5 Comments