Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to change datepicker language based on selected language.?
    primarykey
    data
    text
    <p>I have successful inserted datepicker into my webpage and it works smoothly now. What I need to achieve is that after changing the language from language selector, datepicker must reflect this, show the selected language text.</p> <p>I have the following code, I could not manage to work it so far cause I do not know jquery well. Hope to give someone feedback</p> <pre><code>&lt;head&gt; &lt;script type="text/javascript" src="/scripts/datepicker.core.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/scripts/datepicker.jquery.ui.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/scripts/jquery.ui.datepicker-tr.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/scripts/jquery.ui.datepicker-en-GB.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="LanguageSelector"&gt; &lt;form method="get" action="/"&gt;&lt;select id="LanguageDropDownList" name="lang" onchange="javascript:location='/?lang=' + this.options[this.selectedIndex].value" &gt;&lt;option value="en" selected="selected" &gt;English (en)&lt;/option&gt;&lt;option value="tr"&gt;Türkçe (tr)&lt;/option&gt;&lt;/select&gt;&lt;noscript&gt;&lt;input type="submit" value="&gt;"&gt;&lt;/noscript&gt;&lt;/form&gt; &lt;/div&gt; &lt;div class="calendar" id="datepicker"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; var initialCalendar = true; $(function() { $.datepicker.setDefaults( $.datepicker.regional[ ' ' ] ); var eventDays = [&lt;%=dateOfEvent%&gt;]; $('#datepicker').datepicker($.datepicker.regional[ 'tr' ], { inline: true, dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true, onSelect: function(date) { if(!initialCalendar){ for(var i in eventDays){ if(eventDays[i].Date == date){ window.location = eventDays[i].Url; } } }else{ initialCalendar = false; } }, beforeShowDay: function(thedate) { thedate = thedate.format("yyyy-MM-dd"); for(var i in eventDays){ if(eventDays[i].Date == thedate){ return [true,""]; } } return [false, ""]; } }); $( '#LanguageDropDownList' ).change(function() { $( '#datepicker' ).datepicker( "option", $.datepicker.regional[ $( this ).val() ] ); }); }); Date.prototype.format = function(format) { var o = { "M+" : this.getMonth()+1, "d+" : this.getDate(), "h+" : this.getHours(), "m+" : this.getMinutes(), "s+" : this.getSeconds(), "q+" : Math.floor((this.getMonth()+3)/3), "S" : this.getMilliseconds() } if(/(y+)/.test(format)) format=format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); for(var k in o)if(new RegExp("("+ k +")").test(format)) format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length)); return format; } &lt;/script&gt; &lt;/body&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload