Localizing Calendar

dhtmlxCalendar allows its users to add and use different languages with the ability to switch between them dynamically. First, you need to define necessary language settings. This can be done in the following way:

// settings for a new language (Russian)
// make sure dhtmlxcalendar.js will be loaded
dhtmlXCalendarObject.prototype.langData["ru"] = {
    // date format for inputs
    dateformat: "%d.%m.%Y",
    // header format
    hdrformat: "%F %Y",
    // full names of months
    monthesFNames: ["Январь","Февраль","Март","Апрель","Май","Июнь",
                    "Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],
    // short names of months
    monthesSNames: ["Янв","Фев","Мар","Апр","Май","Июн",
                    "Июл","Авг","Сен","Окт","Ноя","Дек"],
    // full names of days
    daysFNames: ["Воскресенье","Понедельник","Вторник","Среда",
                    "Четверг","Пятница","Суббота"],
    // short names of days
    daysSNames: ["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],
    // starting day of a week. Number from 1(Monday) to 7(Sunday)
    weekstart: 1,
    // the title of the week number column
    weekname: "н",
    // name of the "Today" button
    today: "Сегодня",
    // name of the "Clear" button
    clear: "Очистить"
};

When you have the necessary language settings, you can switch between them using the loadUserLanguage() method (see details):

myCalendar.loadUserLanguage("ru");

If you'd like to apply language settings once for all calendar instances, use:

// make sure dhtmlxcalendar.js will be loaded
dhtmlXCalendarObject.prototype.lang = "ru";

Related sample:  Custom language

Back to top