По умолчанию все ярлыки Scheduler на английском языке. Некоторые из них можно перевести на желаемый язык:
В пакете Scheduler присутствует только en-US локаль. Ознакомьтесь с нашим репозиторием. Здесь вы можете найти интересующую вас локаль или же создать свою.
Названия хранятся в объекте:
export default {
//navigation
Week: "Week",
Day: "Day",
Month: "Month",
Agenda: "Agenda",
Units: "Units",
Timeline: "Timeline",
Today: "Today",
Create: "Create",
Next: "Next",
Previous: "Previous",
"Next day": "Next day",
"Previous day": "Previous day",
"Next week": "Next week",
"Previous week": "Previous week",
"Next month": "Next month",
"Previous month": "Previous month",
// managing calendars
"Add calendar": "Add calendar",
"Do you really want to remove this calendar?":
"Do you really want to remove this calendar?",
"Edit calendar": "Edit calendar",
Delete: "Delete",
Save: "Save",
Title: "Title",
Color: "Color",
Active: "Active",
Settings: "Settings",
"(no title)": "(no title)",
"Inactive calendar": "Inactive calendar",
// modes
"No Events": "No Events",
"All Day": "All Day",
more: "more",
"Expand all-day events": "Expand all-day events",
"Collapse all-day events": "Collapse all-day events",
// info and form
"The event will be deleted permanently, are you sure?":
"The event will be deleted permanently, are you sure?",
Done: "Done",
"Delete event": "Delete event",
Close: "Close",
Edit: "Edit",
"(No title)": "(No title)",
Event: "Event",
Start: "Start",
End: "End",
Calendar: "Calendar",
Notes: "Notes",
from: "from",
to: "to",
"Edit event": "Edit event",
"Assigned to units": "Assigned to units",
"No units": "No units",
"Unknown unit": "Unknown unit",
//recurring
never: "never",
none: "none",
daily: "daily",
day: "day",
days: "days",
every: "Every",
weekly: "weekly",
week: "week",
weeks: "weeks",
each: "Every",
monthly: "monthly",
month: "month",
months: "months",
yearly: "yearly",
year: "year",
years: "years",
Repeat: "Repeat",
"End repeat": "End repeat",
"Repeats each": "Repeats each",
till: "till",
times: "times",
"weekly, every": "weekly, every",
"monthly, every": "monthly, every",
"yearly, every": "yearly, every",
"every working day": "every working day",
custom: "custom",
Every: "Every",
on: "on",
of: "of",
"after several occurrences": "after several occurrences",
date: "date",
"week on": "week on",
"Change recurring pattern": "Change recurring pattern",
"Save changes?": "Save changes?",
// menus for edit and delete
"All events": "All events",
"This event": "This event",
"This event and the following": "This event and the following",
Cancel: "Cancel",
Apply: "Apply",
"Edit recurring event": "Edit recurring event",
"Timeline scale": "Timeline scale",
Section: "Section",
"Show more": "Show more",
"Copy of": "Copy of",
"Copy event": "Copy event",
};
Чтобы изменить локаль по умолчанию, необходимо:
1. Создать локаль с переводами внутри объекта scheduler.locales следующим образом:
// Перевод на русский
scheduler.locales.ru = {
Week: "Неделя",
Day: "День",
// ...
};
2. Задать текущую локаль для Scheduler с помощью свойства locale внутри конструктора:
webix.ready(function() {
// настройка скрола, необязательно
webix.CustomScroll.init();
webix.ui({
view: "scheduler",
url: "https://docs.webix.com/calendar-backend/",
locale: {
lang: "ru"
}
});
});
Related sample: Scheduler: Custom Locale
Вы можете менять языки динамически, например, при клике по соответствующим кнопкам на панели инструментов.
1. Создайте локали с переводом желаемых маркеров:
scheduler.locales.ru = { // Русский
Week: "Неделя",
Day: "День",
// ...
};
// другие локали
2. Меняйте языки с помощью метода setLang сервиса "locale":
{
view: "segmented",
options: ["en", "ru"],
width: 250,
click: function() {
const locale = $$("scheduler").getService("locale");
locale.setLang(this.getValue());
}
}
Related sample: Scheduler: Switching Locales
Маркеры Webix компонентов внутри Scheduler, а также локализация дат и чисел зависят от текущей локали Webix. Чтобы синхронизировать локализацию Scheduler и Webix, создайте объект webix внутри свойства locale:
{
view:"scheduler",
url:"https://docs.webix.com/calendar-backend/",
locale: {
lang: "en",
webix: {
// меняем локали Webix
en: "en-US",
zh: "zh-CN",
// др. локали
}
}
}
Наверх