По умолчанию все ярлыки Document Manager на английском языке. Некоторые из них можно первести на желаемый язык:
В пакете Document Manager присутствует только en-US локаль. Ознакомьтесь с нашим репозиторием. Здесь вы можете найти интересующую вас локаль или же создать свою.
Названия хранятся в объекте:
export default {
Favorite: "Favorite",
Recent: "Recent",
Shared: "Shared",
Trash: "Trash",
"Add to favorites": "Add to favorites",
"Remove from favorites": "Remove from favorites",
Share: "Share",
Tags: "Tags",
Comments: "Comments",
"Can view": "Can view",
"Can edit": "Can edit",
"Share File": "Share File",
"Invite someone...": "Invite someone...",
Invite: "Invite",
Restore: "Restore",
"Delete from trash": "Delete from trash",
"Restoring...": "Restoring...",
"Empty trash": "Empty trash",
"back to ": "back to ",
"Select a user": "Select a user",
"Add a tag": "Add a tag",
"No comments yet": "No comments yet",
"No users": "No users",
"Available to": "Available to",
"user(s)": "user(s)",
"Manage Tags": "Manage Tags",
"Press Enter to create a new tag": "Press Enter to create a new tag",
"Click Add to create a new tag": "Click Add to create a new tag",
"Open tag settings": "Open tag settings",
"Type to search a tag": "Type to search a tag",
"Show version history": "Show version history",
"Last edited at": "Last edited at",
"Last edited on": "Last edited on",
"Back to editor": "Back to editor",
"Version history": "Version history",
"Show changes": "Show changes",
"Restored from": "Restored from",
"Restore this version": "Restore this version",
// inherited from the File Manager
Save: "Save",
"Save all": "Save all",
Rename: "Rename",
Open: "Open",
Edit: "Edit",
Delete: "Delete",
Folder: "Folder",
"Add New": "Add New",
"My Files": "My Files",
Size: "Size",
Date: "Date",
"back to parent folder": "back to parent folder",
Download: "Download",
Type: "Type",
Information: "Information",
Files: "Files",
Table: "Table",
Cards: "Cards",
Total: "Total",
"Are you sure ?": "Are you sure ?",
Details: "Details",
"Enter a new name": "Enter a new name",
Add: "Add",
"Select something": "Select something",
"Download file": "Download file",
Preview: "Preview",
Refresh: "Refresh",
"Are you sure you want to exit without saving?":
"Are you sure you want to exit without saving?",
"Save before closing?": "Save before closing?",
Copy: "Copy",
Cut: "Cut",
Paste: "Paste",
"Deleting...": "Deleting...",
"Copying...": "Copying...",
"Moving...": "Moving...",
Folders: "Folders",
"Search results": "Search results",
"Search results in": "Search results in",
"Search files and folders": "Search files and folders",
"Add new file": "Add new file",
"Add new folder": "Add new folder",
"Upload file": "Upload file",
"Upload folder": "Upload folder",
folder: "folder",
file: "file",
archive: "archive",
audio: "audio",
image: "image",
video: "video",
code: "code",
document: "document",
of: "of",
used: "used",
"Open item location": "Open item location",
"Are you sure you want to delete": "Are you sure you want to delete",
"these items:": "these items:",
"this item:": "this item:",
"Delete files": "Delete files",
and: "and",
"more file(s)": "more file(s)",
"Close the editor": "Close the editor",
"Close this file": "Close this file",
};
Чтобы изменить локаль по умолчанию, необходимо:
1. Создать локаль с переводами (ниже представлена русская локаль) внутри объекта docManager.locales следующим образом:
// Перевод на русский
docManager.locales.ru = {
Files: "Файлы",
"My Files": "Моя полка",
Favorite: "Избранные",
Recent: "Недавние",
Shared: "Общие",
Trash: "Корзина",
};
2. Задать текущую локаль для Document Manager с помощью свойства locale внутри конструктора:
webix.ready(function() {
// пользовательский скролл, необязательно
webix.CustomScroll.init();
const dm = {
view: "docmanager",
url: "https://docs.webix.com/docmanager-backend/",
locale: { lang: "ru" },
};
webix.ui(fm);
})
Related sample: Document Manager: Custom Locale
Вы можете менять языки динамически, например, при клике по соответствующим кнопкам на панели инструментов:
1. Сперва создайте локали с переводом желаемых маркеров:
docManager.locales.ru = { // Русский
Files: "Файлы", "My Files": "Моя полка", ...
};
docManager.locales.zh = { // Китайский
Files: "檔案", "My Files": "我的檔案", ...
};
2. Меняйте языки с помощью метода setLang сервиса "locale":
{
rows: [
{
view: "segmented", options: ["en", "ru", "zh"],
click: function() {
const locale = $$("dm").getService("locale");
locale.setLang(this.getValue()); // zh, ru or en
}
},
{ view:"docmanager", id:"dm" }
]
}
Related sample: Document Manager: Switching Locales
Ярлыки Webix компонентов внутри Document Manager, а также локализация дат и чисел зависят от текущей локали Webix. Чтобы синхронизировать локализацию Document Manager и Webix, создайте объект webix внутри свойства locale:
{
view:"docmanager",
id:"dm",
url: "https://docs.webix.com/docmanager-backend/",
locale: {
lang: "en",
webix: {
// смена Webix локалей
en: "en-US",
zh: "zh-CN"
}
}
}
Related sample: Document Manager: Switching Locales
Наверх