CJuiDatePicker and language

Hi,

I’m using the CJuiDatePicker widget. On the widget properties I define ‘language’=>‘de’ for an german version of the datpicker, which works well…

…until now.

The language does not work correctly after adding the jqPlot Plugin ( http://www.jqplot.com ) on the same page.

From that time, the datepicker appears in asian character!? I’m not sure, which language.

Maybe anyone has an idea, how that could be happened?

I asked the jqPlot developer too. He have no idea!

http://groups.google.com/group/jqplot-users/browse_thread/thread/5ac2fcb7b3906d91

Thank you,

rall0r

have you tried to remove the jqplot to see if the date picker would be displayed correctly again?

Of course. And the datepicker workes correctly after removing the plugin.

I asked the developer of this plugin, what his plugin does in the background:

curious: why does the datepicker changes to asian character, not english - which could be an default behavior?

Are there any connections between CJuiDatepicker an asian characters?

Or is it possible, that Yii fires an default value in an specific situation?

…see the file at the attachment… this is the result of the following code:


<?php $this->widget('zii.widgets.jui.CJuiDatePicker',

				array('model'=>$model,

  				  	'attribute'=>'ENDDATE',

  				  	'language'=>'de',

    					// additional javascript options for the date picker plugin

    		 	 		'options'=>array('showAnim'=>'fold',),

  		  	 	 		'htmlOptions'=>array('style'=>'height:20px;'),

					));?>

//Edit/Update:

I did a little experiment: removing jqPlugin form the page,

CJuiDialog works fine in the preferences language (de, es, whatever).

Then, I add the following code from this example: http://docs.jquery.com/UI/Datepicker/setDefaults#code

to get an additional input field with the originally jQuery Datepicker:


	<script>

	$(function() {

		$.datepicker.setDefaults($.datepicker.regional['de']);

		$( "#datepicker" ).datepicker();

		$.datepicker.setDefaults($.datepicker.regional['de']);


	});

	</script>


<div class="demo">

<p>Date: <input id="datepicker" type="text"></p>

</div>

The result is: the CJuiDatepicker widget from Yii shows the date format es expected (in german)

The additional, original datepicker comes up in traditional Chinese!?

Next experiment: i remove the CJuiDatepicker. Now, only the original datepicker ($( “#datepicker” ).datepicker();$.datepicker.setDefaults($.datepicker.regional[‘de’]);) is part of the page.

In this case, the datepicker is’n in Chinese language anymore. It’s English, still ignoring the: $.datepicker.setDefaults($.datepicker.regional[‘de’]);

Any ideas?

I am just trying to think how to debug this… try to omit the language declaration…then try to change it to ‘en’…etc

…i removed the ‘language’=>‘de’ at the CJuiDatepicker.

…the datepicker comes up in Chinese.

i changed ‘language’=>‘de’ to ‘language’=>‘en’ and there was Chinese again! :-S

i changed ‘language’=>‘de’ to ‘language’=>‘es’ and there was spain - as expected.

It looks like, the system default is Chinese. How is this possible? I never used that.

this is weird. I have one last idea. Have you tried to declare the language attribute empty: language=’’

by setting the attribute empty: the CJuiDatepicker comes in English.

…all the time - with or without jqPlot Plugin.

What’s going on here?

:-/

I had same problem,

Its bugged you have to use a date picker without plugin

Is it a bug from jqPlot or an bug from CJuiDialog / DatePicker?

I think it’s up to the jQuery JUI datepicker

Check the documentation for the localization - http://jqueryui.com/...r/#localization

Click the "view source" to see all the language codes… scroll down a bit (there is much empty space)

seems that there is no "en" code

there are only those:

<option value="en-AU">English/Australia</option> <option value="en-NZ">English/New Zealand</option> <option value="en-GB">English/UK</option>

But that doesn’t explain, why I have an datepicker in Chines, by activating the jqPlot Pluging?!!

I just tried to explain you why “en” did not work… and that it’s not a problem of CJuiDatePicker but of the jQuery plugin…

To find why it does not work with jqPlot you would need to debug it’s source (JS)…

Do you know, in what situation CJuiDatePicker could switch to Chinese language?

>you would need to debug it’s source (JS)…

…okay…but I’m unable to do that (missing JS knowledge)

…I’m working on that problem for 1 1/2 days! Argh!

It feels like searching the needle in the haystack.

So I tried the following:

removing jqPlot form the webpage —> CJuiDialog displays local languages (de, es, fr, etc.)

using flot jQuery Plugin (an other graph plugin) instead of jqPlot —> CJuiDialog displays Chinese (!)

–conclusion—> the single graph plugin is not cause of the strange behavior of languages in CJuiDialog

removing CJuiDialog from the page and using original jQuery DatePicker instead —> DatePicker language is default/english

adding DatePicker localization $.datepicker.setDefaults($.datepicker.regional[‘de’]) and CJuiDialog is still removed —> DatePicker language is german (de) as exacted

adding jQuery Graph (flot) plugin, still using jQuery Datepicker with localization instead of CJuiDialog —> DatePicker language is still german (de)

adding CJuiDialog to the page —> CJuiDialog-DatePicker and the original jQuery DatePicker is in Chinese

removing jQuery Graph (flot) plugin & still use CJuiDialog-DatePicker and the original jQuery —> both datePickers are in Chinese

–conclusion—> by adding the CJuiDialog to the page, the language settings are switched to Chinese.

Those switches seems to be without effect, as long no other datepicker or jQuery Plugin with date functions are on the same page. (by the way: the jQuery Graph plugins are using date-functions to display date-axies.)

It looks like, the widget triggers something … with the Result of Chinese language as default regional setting.

Could that be possible?

…is it possible, that this behavior is an CJuiDatePicker - bug?

//Edit: last try: i did an update to YII 1.1.8… where this problem is fixed! :slight_smile: Jeah!

The problem is solved.

Actually, I still have the same problem, even though using Yii 1.1.8. However, using en-AU or similar is a good enough work-around for me, so it is not a real issue.

I have the same problem.

I use a CJuiDatePicker widget in a normal view with language set to ‘es’ and its works fine. I use CJuiDatePicker widget in a view rendered with an ajaxbutton (renderpartial) and it show me asian characters. I change language to ‘en’ and still asian characters. I set language to nothing (’’) and it show the datepicker in english.

I use last yii version.

@gargamel, i had the same issue. L[size="2"][color="#1c2837"]ook here and check out links posted there. After that you[/color][/size][size="2"][color="#1c2837"]r problem should be solved.[/color][/size]

[size="2"][color="#1c2837"]

[/color][/size]

[size="2"][color="#1c2837"]Regards Robert[/color][/size]

I had the same problem. It seems to be caused by the fact that both jquery-ui.min.js and jquery-ui.i18n.js was included. When I removed jquery-ui.i18n.js, everything worked perfectly, and instead included the correct language file (which I am not allowed to link to, because this is my first post - there is a link to it at the jquery-ui site under datepicker), everything worked perfectly.

Kasper

Hello,

Is it possible to dynamically change the language of the CJuiDatePicker based on the default language of the site ?

Thanks