Solved

Translating "Your Name" field in Help Widget

  • 17 June 2021
  • 6 replies
  • 380 views

Userlevel 1

Hello all!

First time messaging here.

By default, Help Widgets have a field in them that is called “Your Name”. I need to translate this field label to another language (in this case, Finnish).

However, I cannot find the field in either Ticket or Customer fields to rename it. Adding Finnish as a secondary language in the system did not update it in the widget either.

Widget is used outside Freshdesk Portal.

Any advice would be appriciated!

 

icon

Best answer by hemanth.ramya 17 June 2021, 15:20

View original

6 replies

Userlevel 1

If renaming is not an option, would it be possible to remove this field from the widget itself?

Userlevel 5
Badge +9

Hello @hanneskola,

 

We are super happy that you are a part of our Freshworks Community.  

Freshdesk provides Multilingual support API for help widgets to specify translations for labels used in the widget. However, there isn’t a way as such for the default field, Your name. In such cases, you can hide this field using the Hide fields widget API. The below code can be added along with the help widget code embedded in your external website. 

 

​<script>
FreshworksWidget('hide', 'ticketForm', ['name']);
</script>

 

Cheers,

Freshdesk Community Team

Userlevel 1

This solved the issue, thanks a lot!

Userlevel 5
Badge +9

Great, thanks for the update @hanneskola. Glad to be of help! :)

 

Cheers,

Freshdesk Community Team

I have another question regarding the “your name” field. if its not hidden and the customer fills out this field, it does not seem to have any function in filling the customer data. in the ticket list, in the column “contact”, only the first part of the email-adress (so without the @...) is shown, which often times is not the customer name but some funny nickname they used to create their email-adress. can this be changed in any way?

You can add JavaScript to the bottom of the “New Ticket” page:

I will provide an example for “find and replace” using JavaScript on only a specific element. Please be aware that you don’t publish any errors since this might have serious implications. Always create a new theme to test these kind of features first! 

Also, selectors will change when the structure of your template is changed, and thereby have to be recreated after you’re done.

At last, please refrain from using selectors on the header or footer of the portal theme, since this might mess with pages that should not be edited. The path is based on HTML classnames and positions so this path might have multiple outcomes depending on the page you’re browsing. However, if this is intentionally, please add the script at the footer and make sure all pages are tested well!

 

Step1: Paste this code 

<script>

var selector = "...";

selector.innerHTML = "Change to this specific text";

</script>

 

Step2: find out the selector (path to the element)

Right click the element in your webbrowser, within the code this element should now be highlighted. Rightclick the highlighted element and hover over “Copy” to select “Copy JS Path”.
Paste the result to replace “...”. So this will look like 

var selector = document.querySelector("body > p:nth-child(5)")

Please note your result will not show the same result, so do not copy and paste this.

 

Deploying and testing

To test within the page itself you can open up the console (after a right mousclick on the page > inspect). Paste the selector in the input of the console and append .innerHTML = “something”.
If this works all is rightly mapped. If not than you might be editing an element which is the child or parent of the one you need to select. Or it has the text in another place than “.innerHTML”. This includes but is not limited to label, placeholder, textContent and more. Please refer to W3 and your inspect method to find out the exact options.

Reply