const metaTranslate = {
"en-US": {
"nav-home-btn": ' Home',
"nav-connect-btn": ' Connect',
"nav-docs-btn": ' Documentation',
},
"ru-RU": {
"nav-home-btn": ' Главная',
"nav-connect-btn": ' Подключиться',
"nav-docs-btn": ' Документация',
},
};
const translationTree = {
"/": {
"en-US": {
"intro-1": "Welcome to Adventure AI Labs!",
"description-1":
"Embark on an unforgettable adventure with your favorite characters and friends! Visit familiar and unfamiliar locations..",
"button-1": ' Start the adventure',
"intro-2": "Become a gamemaster",
"description-2":
"Or you can become the gamemaster of the party and lead the plot of the characters and players like a creator god who tells an amazing story.",
"button-2": ' Documentation',
"intro-3": "Needed a more gold..",
"description-3":
"The project exists purely on a voluntary basis and the enthusiasm of the author, so if you want to help financially, then it will be very cool (:",
"button-3": ' Donate',
},
"ru-RU": {
"intro-1": "Добро пожаловать в Adventure AI Labs!",
"description-1":
"Отправьтесь в незабываемое приключение вместе со своими любимыми персонажами и друзьями! Посетите знакомые и незнакомые вам локации..",
"button-1": ' Начать приключение',
"intro-2": "Стань мастером партии",
"description-2":
"Либо же ты можешь стать мастером партии и вести сюжет персонажей и игроков словно бог-творец, который рассказывает удивительную историю.",
"button-2": ' Документация',
"intro-3": "Нужно больше золота..",
"description-3":
"Проект существует сугубо на добровольном начале и энтузиазме автора, поэтому если вы захотите помочь финансово, то это будет очень круто (:",
"button-3": ' Задонатить',
},
},
"/connect": {
"en-US": {
title: "Server list",
"enable-cookie-cnt": "Enable Cookie!",
"enable-cookie-text-cnt":
"To work with servers, accept the cookie agreement",
"accept-cookie-show-btn": "Show",
exampleModalLabel: ' Accept cookies',
cookiesText:
"We are obliged to warn you that the AI Adventure Labs protocol client uses cookies for: authorization, storage of session keys and user consent to the use of cookies",
"accept-cookie-btn": "Accept",
loading: "Loading of servers...",
titleDenial:
' Denial of responsibility',
denialText:
"The server data does not belong to a centrally moderated foundation, community or individual, as well as to the developer of the software, program interface (protocol client), or protocol developer. Any content posted on servers is posted by the server administrator and can be absolutely anything. You assume all risks for the content and connect to the server at your own peril and risk!",
"accept-denial-btn": "Accept",
titleCustomServerConnect:
' Connect to remote server',
titleCustomConnect: "Connection Data",
addressCustomConnect:
"Enter address of server (without ws(s):// and port)",
portCustomConnect: "Enter port of server",
tlsCustomConnect: "Check this if server use TLS (wss:// connection):",
"custom-connect-btn": "Connect",
"server-name-tbl": "Name",
"server-address": "Address",
"server-encryption": "Encryprtion",
"server-ping": "Ping",
"server-action": "Action",
"add-custon-server": "Connect to custom server",
"offline-server": "Offline",
"connect-to-server-btn": "Connect",
"connection-failed": "Connection failed",
"retry-connecting": "Retry",
},
"ru-RU": {
title: "Список серверов",
"enable-cookie-cnt": "Примите соглашение о Cookie!",
"enable-cookie-text-cnt":
"Для работы с серверами, примите соглашение об использовании файлов Cookie",
"accept-cookie-show-btn": "Посмотреть",
exampleModalLabel: ' Вопрос с печеньками',
cookiesText:
"Мы обязаны вас предупредить, что клиент протокола AI Adventure Labs использует файлы куки для: авторизации, хранения ключей сессии и согласия пользователя на использование куки",
"accept-cookie-btn": "Принять",
loading: "Загрузка серверов...",
titleDenial:
' Отказ от отвественности',
denialText:
"Данные сервера не принадлежат централизованно-модерируемому фонду, сообществу или частному лицу, а также разработчику программного обеспечения, програмного интерфейса (клиента протокола), разработчику протокола. Любой размещённый на серверах контент размещается администратором сервера и может быть абсолютно любым. Все риски за контент вы берёте полностью на себя и подключаетесь к серверу на свой страх и риск!",
"accept-denial-btn": "Принять",
titleCustomServerConnect:
' Прямое подключение к серверу',
titleCustomConnect: "Данные подключения",
addressCustomConnect: "Адрес сервера (без порта и ws(s)://)",
portCustomConnect: "Порт сервера",
tlsCustomConnect: "Использовать защищённое соединение (TLS) (wss://):",
"custom-connect-btn": "Подключиться",
"server-name-tbl": "Имя сервера",
"server-address": "Адрес",
"server-encryption": "Шифрование",
"server-ping": "Пинг",
"server-action": "Действие",
"add-custon-server": "Подключиться напрямую",
"offline-server": "Не в сети",
"connect-to-server-btn": "Подключиться",
"connection-failed": "Соединение оборвалось",
"retry-connecting": "Повторить попытку",
},
},
"/connect-area": {
"en-US": {},
"ru-RU": {},
},
};
Object.entries(translationTree).forEach(([page, langs]) => {
Object.entries(langs).forEach(([lang]) => {
translationTree[page][lang] = {
...translationTree[page][lang],
...metaTranslate[lang],
};
});
});
console.log(translationTree);
const simpleLangTags = {
ru: "ru-RU",
en: "en-US",
};
function tr(page, id) {
let lang = navigator.language || navigator.userLanguage;
lang =
lang.split("-").length === 1 ? (simpleLangTags[lang] ?? "en-US") : lang;
// Britains sucks, Sir Keir Starmer (Sir Dicksucker) is faggot, he is sucking a muslim's dicks.
if (lang === "en-UK") lang = "en-US";
// console.log("lang is", lang);
return (
translationTree[page]?.[lang]?.[id] ??
translationTree[page]?.["en-US"][id] ??
null
);
}