Setting french language to dhtmlxCalendar

Hello,

How can I set french language to dhtmlxCalendar in a form with xml ?

Thanks for your answer

@++
JC

Hello,

You can call loadUserLanguage after calendar init or do little trick,
add dhtmlXCalendarObject.prototype.langData[“fr”] = {…} like in this demo:
dhtmlx.com/docs/products/dht … guage.html
and set dhtmlXCalendarObject.prototype.lang = “fr” before loading or change text in dhtmlXCalendarObject.prototype.langData[“en”]

Thanks, but i was talking in a form and with xml

It is possible ?

Thanks in advance

@++
JC

Any answer would be appreciated

@++
JC

Hi,

  1. To set text for calendar (months names, day-of-week names,…) you need:
    1.a) add some js code, like dhtmlXCalendarObject.prototype.langData[“fr”] = {…} (see details in post/link above)
    1.b) after calendar init - call myCalendar.loadUserLanguage(“fr”);

  2. Due you’re using xml for form loading and form use async requests, you need to attach event to form to get it triggered when form/calendar will inited (otherwise browser will tell you that it null or not an object). For this use the following code:

var myForm = new dhtmlXForm(...); myForm.attachEvent("onXLE",functuon(){ // this func will called after form/calendar will inited // 2.a) get calendar instance var calendar = myForm.getCalendar("PostDate"); calendar.loadUserLanguage("fr"); }); myForm.loadStruct("formdata.xml");

  1. XML template:

<?xml... <item type="calendar" name="PostDate" .../> ...>

Something like.

Hello Andrei,

I’ve tested and it works :slight_smile:

However, it would be a lot easier to have an option lang_calendar=“fr” in XML form file like this :

...
<item type="calendar" lang_calendar="fr" value="" inputWidth="100" name="acquisition_d" dateFormat="%d.%m.%Y" serverDateFormat="%Y-%m-%d" label="Date d'acquisition"/>
<item type="calendar" lang_calendar="fr" value="" inputWidth="100" name="install_d" dateFormat="%d.%m.%Y" serverDateFormat="%Y-%m-%d" label="Date d'installation"/>
...

the JS code could be more generic (I don’t know what are the calendar’s name and how many calendars are in a XML form file).

I hope this option could be in a future version.

Anyway, it works, thanks :slight_smile: