Heyvaert / wiquery

Automatically exported from code.google.com/p/wiquery
0 stars 0 forks source link

DatePicker bug when using english locale and ajax #24

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a page with an empty panel in it
2. Create a panel with a DataPicker in it
3. Make sure your locale is english
4. Replace the empty panel with the panel containing the DatePicker
5. Append some extra javascript to run after ajax completes

What is the expected output? What do you see instead?

The panel should get replaced and the the extra javascript should run.
Instead, javascript stops executing because ui.datepicker-en.js cannot be 
found. A 404 error is shown.

What version of the product are you using? On what operating system?

1.0-m2

Solution:

A simple solution is to add an empty ui.datepicker-en.js file to the 
following location:

org/odlabs.wiquery/ui/datapicker/i18n/ui.datepicker-en.js

I'm sure there would be better solutions than this, but that's what I did 
to get it working.

Original issue reported on code.google.com by yowza...@gmail.com on 22 Oct 2009 at 8:51

GoogleCodeExporter commented 9 years ago
Hi,

Maybe the solution is to prevent the import of the ui.datepicker-en.js file 
into the
contribute method :

public void contribute(WiQueryResourceManager wiQueryResourceManager) {

wiQueryResourceManager.addJavaScriptResource(DatePickerJavaScriptResourceReferen
ce.get());

   if(!getLocale().equals(Locale.ENGLISH){
      wiQueryResourceManager.addJavaScriptResource(new
DatePickerLanguageResourceReference(
                                                getLocale()));
   }
}

I will try it tonight.

Original comment by roche....@gmail.com on 22 Oct 2009 at 11:56

GoogleCodeExporter commented 9 years ago

Original comment by roche....@gmail.com on 22 Oct 2009 at 8:27

GoogleCodeExporter commented 9 years ago
Still not working.  Please change:

if(!Locale.ENGLISH.equals(getLocale())){ // #issue 24

To this or something similar:

if(!Locale.ENGLISH.getLanguage().equals(getLocale().getLanguage())){ // #issue 
24

On my system, getLocale() returns "en_US", while Locale.ENGLISH returns "en".  
So the 
test fails.

Original comment by yowza...@gmail.com on 29 Oct 2009 at 8:32

GoogleCodeExporter commented 9 years ago
Indeed, I will fix it tonight.

Original comment by roche....@gmail.com on 30 Oct 2009 at 12:59

GoogleCodeExporter commented 9 years ago
Hi, I fixed the bug.

Moreover, I changed the DatePickerLanguageResourceReference to load the right 
file
when the locale is Traditionnal Chinese, Simplified Chinese, Portuguese Brazil.

Original comment by roche....@gmail.com on 30 Oct 2009 at 8:42

GoogleCodeExporter commented 9 years ago
Still not quite right yet.  Please change:

if(locale != null && !Locale.ENGLISH.getLanguage().equals(locale)){ 

To this:

if(locale != null && 
!Locale.ENGLISH.getLanguage().equals(locale.getLanguage())){ 

This is because ENGLISH.getLanguage() returns a STRING, so comparing it to a 
Locale 
fails.

Original comment by yowza...@gmail.com on 31 Oct 2009 at 6:34

GoogleCodeExporter commented 9 years ago
Hi,
I totally forgot to change this part of the condition. Sorry for that.

The bug is fixed into the revision 212.

Thanks for your feedback.

Regards

Julien

Original comment by roche....@gmail.com on 2 Nov 2009 at 8:24

GoogleCodeExporter commented 9 years ago
Will be part of 1.0 release

Original comment by lionel.armanet@gmail.com on 4 Nov 2009 at 9:53