This repository has been archived by the owner on Jan 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
locale.js
61 lines (59 loc) · 2.12 KB
/
locale.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const locales = {
"ru": {
"localeName": "ru",
"pageTitle": "Файловый менеджер",
"goBeforeTitle": "назад",
"createFileTitle": "создать",
"uploadFileTitle": "загрузить",
"editorSaveTitle": "сохранить файл",
"editorSaveText": "СОХРАНИТЬ",
"editorExitTitle": "закрыть редактор",
"dialogExitTitle": "закрыть диалог создания",
"dialogTitleText": "Создание",
"dialogInputText": "Имя",
"typeFileText": "Файл",
"typeFileTitle": "файл",
"typeDirText": "Папка",
"typeDirTitle": "папка",
"dialogButtonTitle": "создать файл",
"dialogButtonText": "Создать",
"authTitle": "Авторизация",
"authHeader": "Авторизуйтесь",
"loginPlaceholder": "Логин",
"passwordPlaceholder": "Пароль",
"loginButtonText": "Войти"
},
"en": {
"localeName": "en",
"pageTitle": "File Manager",
"goBeforeTitle": "back",
"createFileTitle": "create",
"uploadFileTitle": "upload",
"editorSaveTitle": "save file",
"editorSaveText": "SAVE",
"editorExitTitle": "close editor",
"dialogExitTitle": "close creation dialog",
"dialogTitleText": "Creation",
"dialogInputText": "Name",
"typeFileText": "File",
"typeFileTitle": "file",
"typeDirText": "Folder",
"typeDirTitle": "folder",
"dialogButtonTitle": "create file",
"dialogButtonText": "Create",
"authTitle": "Authentificate",
"authHeader": "Please sign in",
"loginPlaceholder": "Login",
"passwordPlaceholder": "Password",
"loginButtonText": "Sign in"
}
}
function locale(localeName, data) {
for (let key in locales[localeName]) {
while (data.indexOf(`{_${key}_}`) != -1) {
data = data.replace(`{_${key}_}`, locales[localeName][key])
}
}
return data
}
module.exports = locale