Localization
You can apply different languages to the DHTMLX Timepicker interface. Translate the strings for the Timepicker labels and apply the locale to the component.
Default locale
The default locale for Timepicker looks like this:
const en = {
// labels of the sliders
hours: "Hours",
minutes: "Minutes",
// label of the Save button
save: "Save"
};
Timepicker renders the Save button only if you enable the controls property.
Custom locale
Follow these steps to use a different locale:
- Define the language settings. Provide the labels of the sliders and of the Save button:
const de = {
hours: "Stunden",
minutes: "Minuten",
save: "Speichern"
};
- Call the
dhx.i18n.setLocale()method before you initialize Timepicker:
dhx.i18n.setLocale("timepicker", de);
const timepicker = new dhx.Timepicker("timepicker_container");
The method merges the passed labels into the current locale, so you can redefine only the labels you need.
note
A timepicker inside a calendar takes its labels from the Timepicker locale as well. The calendar locale defines the other labels. For details, read the Calendar Localization guide.