diff --git a/.env.example b/.env.example index ed764e1..62151a0 100644 --- a/.env.example +++ b/.env.example @@ -9,6 +9,8 @@ VITE_SUPPORT_URL=https://t.me/YourID VITE_OFF_SECTIONS={"appsBox": true, "logoBox": true, "timeBox": true, "usageBox": true, "userBox": true, "supportBox": true, "configs": true} # Apps JSON URL VITE_JSON_APPS_URL=https://raw.githubusercontent.com/MatinDehghanian/public-assets/refs/heads/main/json/os.json +# Second Language Select {Options : en - ru } +VITE_SECOND_LANG=ru ### Host Settings # Host URL diff --git a/src/components/Apps.jsx b/src/components/Apps.jsx index 6a1b450..d973e02 100644 --- a/src/components/Apps.jsx +++ b/src/components/Apps.jsx @@ -224,7 +224,7 @@ const renderAppAccordion = ( - {lang === "en" ? app.description : app.faDescription} + {lang === "fa" ? app.faDescription : app.description} {app.downloadLink && renderButtonGrid( @@ -356,7 +356,7 @@ const Apps = ({ subLink }) => { - {lang === "en" ? os.engName : os.name} + {lang === "fa" ? os.name : os.engName} diff --git a/src/components/RadioButtons.jsx b/src/components/RadioButtons.jsx index 43707f5..4d2111f 100644 --- a/src/components/RadioButtons.jsx +++ b/src/components/RadioButtons.jsx @@ -34,7 +34,8 @@ const RadioButtons = ({ setIsDarkMode }) => { }; const handleLangChange = () => { - const newLang = lang === "fa" ? "en" : "fa"; + const newLang = + lang === "fa" ? import.meta.env.VITE_SECOND_LANG || "en" : "fa"; i18n.changeLanguage(newLang); Cookies.set("language", newLang, { expires: 90 }); }; @@ -81,10 +82,12 @@ const RadioButtons = ({ setIsDarkMode }) => { icon={"فارسی"} /> {/* Theme Toggle */} diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json new file mode 100644 index 0000000..6038ef7 --- /dev/null +++ b/src/locales/ru/translation.json @@ -0,0 +1,47 @@ +{ + "remaining_volume": "Осталось траффика", + "initial_volume": "Весь траффик", + "remaining_time": "Осталось времени", + "initial_time": "Всего времени", + "megabytes": "МБ", + "gigabytes": "ГБ", + "days": "дней", + "welcome": "Приветствуем", + "Russian": "Русский", + "English": "English", + "Persian": "فارسی", + "status": { + "active": "Активно", + "expired": "Срок закончился", + "on_hold": "На удержании", + "disabled": "Отключена", + "limited": "Закончился лимит" + }, + "support": "Поддержка", + "userPanelTitle": "Подписка пользователя {brandName}.", + "userPanelWelcome": "Добро пожаловать в подписку пользователя {brandName}.", + "operatingSystems": "Операционные системы", + "configuration": "Добавить в приложение", + "download": "Скачать", + "watchVideo": "Посмотреть туториал", + "configsList": "Список конфигов", + "emergancyList": "Emergancy конфиги", + "linkCopied": "Ссылка скопирована", + "expired": "Срок закончился", + "hours": "часов", + "minutes": "минут", + "years": "лет", + "copyAll": "Скопировать все", + "B": "Б", + "KB": "КБ", + "MB": "МБ", + "GB": "ГБ", + "TB": "ТБ", + "negative": "Негативно", + "infinity": "Бесконечно", + "subQRCode": "QR-код подписки", + "free": "Бесплатно", + "light": "Светлая", + "dark": "Темная", + "ended": "Закончилось" +} diff --git a/src/utils/Helper.js b/src/utils/Helper.js index a54f908..f18308d 100644 --- a/src/utils/Helper.js +++ b/src/utils/Helper.js @@ -53,7 +53,7 @@ export const extractNameFromConfigURL = (url) => { export const calculateRemainingTime = (expire, t) => { - if (!expire) return t("unknown"); + if (!expire) return t("infinity"); let expireTimestamp; if (typeof expire === "number") { diff --git a/src/utils/i18n.js b/src/utils/i18n.js index 0c474b6..6d6b62d 100644 --- a/src/utils/i18n.js +++ b/src/utils/i18n.js @@ -2,6 +2,7 @@ import i18n from "i18next"; import { initReactI18next } from "react-i18next"; import enTranslation from "../locales/en/translation.json"; import faTranslation from "../locales/fa/translation.json"; +import ruTranslation from "../locales/ru/translation.json"; i18n.use(initReactI18next).init({ resources: { @@ -11,9 +12,12 @@ i18n.use(initReactI18next).init({ fa: { translation: faTranslation, }, + ru: { + translation: ruTranslation, + }, }, lng: "fa", - fallbackLng: "en", + fallbackLng: import.meta.env.VITE_SECOND_LANG || "en", interpolation: { escapeValue: false, },