Opened 11 years ago

Closed 11 years ago

Last modified 3 years ago

#8266 closed bug (wontfix)

Google Translate breaks datepicker

Reported by: eirc Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.datepicker Version: 1.8.19
Keywords: Cc:
Blocked by: Blocking:


Using Google translate on a page breaks the datepicker which fills the fields with a value of "NaN/NaN/NaN".

A workaround is to add a notranslate class to the datepicker which prevents Google Translate from breaking it. However I guess that a better solution would be to allow it to translate but not break :)


I also don't know if any other widgets are affected by this.

Change History (3)

comment:2 Changed 11 years ago by Scott González

Resolution: wontfix
Status: newclosed

Google Translate doesn't follow any standards. I don't think we should be adding 3rd party classes to our widgets. If Google Translate ever supports a standard like @translate, then we can consider this. Out of curiosity, do you know what is getting translated that is killing the datepicker?

comment:3 Changed 3 years ago by koendewit

The reason why the datepicker doesn't work is that Google Translate wraps all text in <font /> tags, including the day numbers of the calender.

These contents of a cell in the calendar table:

<a class="ui-state-default" href="#">14</a>

will be converted by Google Translate to:

<a class="ui-state-default" href="#">
    <font style="vertical-align: inherit;">
        <font style="vertical-align: inherit;">14</font>

The result is that this line in the jQuery UI code will fail to find the number of the day clicked:

inst.selectedDay = inst.currentDay = $( "a", td ).html();

A possible workaround is to add the notranslate class to the datepicker div immediatly after creating the datepicker:

Note: See TracTickets for help on using tickets.