Localization
The library supports scheduler localization by providing a number of predefined locales and a way to create custom ones. By default, DHTMLX Scheduler uses the English locale.
Activation
To set the desired language for the scheduler, activate the necessary locale via the setLocale() method of the scheduler.i18n object.
scheduler.i18n.setLocale("fr");
You can use and update any of the predefined locales that are bundled with the dhtmlxscheduler.js file or define a custom locale.
The locale can be switched dynamically, but the changes will be applied only after a complete redraw of the Scheduler with either the scheduler.render() or scheduler.init() call.
scheduler.i18n.setLocale("fr");
scheduler.init("scheduler_here");
Related samples
Included locales
Both Common locale files and Recurring locale files reside in the dhtmlxscheduler.js file.
dhtmlxScheduler includes localization for the following languages:
| Language | Language code |
| Arabic | ar |
| Belarusian | be |
| Catalan | ca |
| Chinese | cn |
| Czech | cs |
| Danish | da |
| Dutch | nl |
| English | en (default) |
| Finnish | fi |
| French | fr |
| German | de |
| Greek | el |
| Hebrew | he |
| Hungarian | hu |
| Indonesian | id |
| Italian | it |
| Japanese | jp |
| Norwegian | no |
| Norwegian Bokmål | nb |
| Polish | pl |
| Portuguese | pt |
| Romanian | ro |
| Russian | ru |
| Slovak | sk |
| Slovenian | si |
| Spanish | es |
| Swedish | sv |
| Turkish | tr |
| Ukrainian | ua |
Creating custom locale
The scheduler.i18n object is added in v6.0. In previous versions, the scheduler.locale object was used. For more information, see the Migration article.
The easiest way to create a custom locale is to make a copy of the default English locale from the sample below and translate all strings into the required language.
The custom locale can be applied to the Scheduler in two ways:
- either override the current locale by passing a locale object as a parameter to the
setLocale()method:
scheduler.i18n.setLocale(localeObject);
Note, if you provide a partial locale object, the scheduler will add your labels into the current locale:
scheduler.i18n.setLocale({
labels: {
day_tab: "Day",
}
});
- or, if you need to switch between several locales, define the locale with a custom language code and switch the scheduler to it later:
scheduler.i18n.addLocale("lang", localeObject);
scheduler.i18n.setLocale("lang");
Note, activating a custom locale in the app will cause changes in the app's interface. Check and redefine (if required) all locale-dependent elements to be sure that the scheduler looks fine in its new language.
Note
- You can send your custom locale file to support@dhtmlx.com so we can include it in the next release.
- The currently active locale is also available in the
scheduler.localeobject. monthFull- the full names of months starting from JanuarymonthShort- the short names of months starting from JanuarydayFull- the full names of week days starting from SundaydayShort- the short names of week days starting from Sunday
English locale definition
scheduler.i18n.setLocale({
date: {
month_full: ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"],
month_short: ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
day_full: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday"],
day_short: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
},
labels: {
dhx_cal_today_button: "Today",
day_tab: "Day",
week_tab: "Week",
month_tab: "Month",
new_event: "New event",
icon_save: "Save",
icon_cancel: "Cancel",
icon_details: "Details",
icon_edit: "Edit",
icon_delete: "Delete",
confirm_closing: "", // Your changes will be lost, are your sure?
confirm_deleting: "Event will be deleted permanently, are you sure?",
section_description: "Description",
section_time: "Time period",
full_day: "Full day",
/* recurring events */
confirm_recurring: "Edit recurring event",
section_recurring: "Repeat event",
button_recurring: "Disabled",
button_recurring_open: "Enabled",
button_edit_series: "All events",
button_edit_occurrence: "This event",
button_edit_occurrence_and_following: "This and following events",
/* agenda view extension */
agenda_tab: "Agenda",
date: "Date",
description: "Description",
/* year view extension */
year_tab: "Year",
/* week agenda extension */
week_agenda_tab: "Agenda",
/* grid view extension */
grid_tab: "Grid",
/* touch tooltip */
drag_to_create: "Drag to create",
drag_to_move: "Drag to move",
/* dhtmlx message default buttons */
message_ok: "OK",
message_cancel: "Cancel",
/* wai aria labels for non-text controls */
next: "Next",
prev: "Previous",
year: "Year",
month: "Month",
day: "Day",
hour: "Hour",
minute: "Minute",
/* legacy recurring event components */
repeat_radio_day: "Daily", // name="repeat" value="day"
repeat_radio_week: "Weekly", // name="repeat" value="week
repeat_radio_month: "Monthly",
repeat_radio_year: "Yearly",
repeat_radio_day_type: "Every",
repeat_text_day_count: "day",
repeat_radio_day_type2: "Every workday",
repeat_week: " Repeat every",
repeat_text_week_count: "week next days:",
repeat_radio_month_type: "Repeat",
repeat_radio_month_start: "On",
repeat_text_month_day: "day every",
repeat_text_month_count: "month",
repeat_text_month_count2_before: "every",
repeat_text_month_count2_after: "month",
repeat_year_label: "On",
select_year_day2: "of",
repeat_text_year_day: "day",
select_year_month: "month",
repeat_radio_end: "No end date",
repeat_text_occurrences_count: "occurrences",
repeat_radio_end2: "After",
repeat_radio_end3: "End by",
/* recurring event components */
repeat_never: "Never",
repeat_daily: "Every day",
repeat_workdays: "Every weekday",
repeat_weekly: "Every week",
repeat_monthly: "Every month",
repeat_yearly: "Every year",
repeat_custom: "Custom",
repeat_freq_day: "Day",
repeat_freq_week: "Week",
repeat_freq_month: "Month",
repeat_freq_year: "Year",
repeat_on_date: "On date",
repeat_ends: "Ends",
month_for_recurring: ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"],
day_for_recurring: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday"]
}
});
Related samples
Additional notes
- If the
confirm_closingorconfirm_deletinglabel is not defined, the related confirm dialog will not be shown at all (auto-confirm) - The
section_(name)label refers to the lightbox section of the related name - The
new_eventlabel defines the default text of a new event