Question
How can I restrict my support forms based on language especially for users who are not signed in?
Answer
There are certain scenarios where you may wish your ticket forms to have a different design or questions based on the language. By default, the system shows all the different support forms. To restrict the ticket forms from showing in specific languages, you can make a slight modification to the javascript in your theme by identifying the user's language.
The workflow described in this article is based in the article Multibrand - Display the appropriate forms on the correct Help Center (Enterprise).
To get started, find the ID's of the ticket forms you want to hide or show. To find the ID of a ticket form, check How do I find the ID of a ticket form?.
Switching to another language using the Help Center selector also updates the HTML element Lang to the appropriate language code:
All browsers have a view source type of view that lets you look at some of the code that makes up the page. Find below two good external articles to view the source for most browsers:
- How to View the Source Code of a Web Page in Every Browser
- How to view the HTML source code of a web page
Once you open the source, go to the top of the page and you'll find similar lang values like below:
-
US English
-
Portuguese
For each language you want to support, view source using the browser and capture the correct code.
Next step is to edit your Zendesk Theme and place the bit of javascript in.
To edit the theme code
- In Guide, click the Customize design icon (
) in the sidebar.
- Click the theme you want to edit to open it.
- Click the Edit code button
- Click the script.js file and place the below code inside the
$(document).ready(function().{.var htmllang = document.documentElement.lang;
if (htmllang !== "pt"){
// if not portuguese remove pt form
$('#request_issue_type_select option[value="360000342334"]').remove();
$('.nesty-panel').on('DOMNodeInserted', function(e){ $(this).children('ul').children().remove('#360000342334');
});
}
if (htmllang !== "en-US"){
// if not english remove english form
$('#request_issue_type_select option[value="360000301514"]').remove();
$('.nesty-panel').on('DOMNodeInserted', function(e){
$(this).children('ul').children().remove('#360000301514');
});
}
If you have additional languages, you'll need to copy and those add additional languages with their corresponding IDs.
- Click Publish on the upper right-hand side of the script.js file.
To verify that this has worked go back to your guide/support site and choose one of the languages you have in your support site and it should only show the form for that language. You may need to clear your cache to ensure the changes have been applied.
0 Comments
Please sign in to leave a comment.