How to Stop Date Picker Date change while using Google Translator

Stop Date Picker Date change while using Google Translator

 

In the Website, when  changing the language from English to other Language like swedish, chinese or any other language, the Date picker value is changing & showing like NaN/NaN/NaN.

But, the Datepicker format is mm/dd/yyyy

Solution:

For, these we have to find the Date picker container where date i showing. Then find the below classes added in that container,

ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all

Then Add a new class with them, “notranslate”

ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all notranslate

If Google find this class in the container, Google will not translate the content of the container.

keyword “notranslate” will prevent your calendar to translate.

We, can add class using this function, like

$(function() {
    $(".datepicker").datepicker();
    $('.ui-datepicker').addClass('notranslate');
});

 

If you like our post, Please Comment & share.

How to integrate google language translater in website

It is the link , from here we can create a plug-in for Google translater. https://translate.google.com/manager/website/ A small code will generate like: Script code will be like:: Paste it in your website:: <div id=”google_translate_element”></div><script type=”text/javascript”> function googleTranslateElementInit() {   new google.translate.TranslateElement({pageLanguage: ‘en’, layout: google.translate.TranslateElement.InlineLayout.SIMPLE, multilanguagePage: true}, ‘google_translate_element’); } </script><script type=”text/javascript” src=”//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit”></script>