localization

This commit is contained in:
2025-09-13 15:16:05 +09:00
parent e81725e4d5
commit 1eb7d1c9bc
11 changed files with 660 additions and 11 deletions

View File

@@ -3,7 +3,7 @@ import { Pool, PoolConfig } from 'pg';
// Конфигурация пула соединений PostgreSQL
const poolConfig: PoolConfig = {
host: process.env.DB_HOST || 'localhost',
port: parseInt(process.env.DB_PORT || '5432'),
port: parseInt(process.env.DB_PORT || '5433'),
database: process.env.DB_NAME || 'telegram_tinder_bot',
user: process.env.DB_USERNAME || 'postgres',
...(process.env.DB_PASSWORD && { password: process.env.DB_PASSWORD }),

View File

@@ -2,6 +2,7 @@ import TelegramBot, { Message, InlineKeyboardMarkup } from 'node-telegram-bot-ap
import { ProfileService } from '../services/profileService';
import { MatchingService } from '../services/matchingService';
import { Profile } from '../models/Profile';
import { getUserTranslation } from '../services/localizationService';
export class CommandHandlers {
private bot: TelegramBot;
@@ -104,15 +105,18 @@ export class CommandHandlers {
const profile = await this.profileService.getProfileByTelegramId(userId);
if (!profile) {
const createProfileText = await getUserTranslation(userId, 'profile.create');
const noProfileText = await getUserTranslation(userId, 'profile.noProfile');
const keyboard: InlineKeyboardMarkup = {
inline_keyboard: [
[{ text: '🚀 Создать профиль', callback_data: 'create_profile' }]
[{ text: createProfileText, callback_data: 'create_profile' }]
]
};
await this.bot.sendMessage(
msg.chat.id,
'❌ У вас пока нет профиля.\nСоздайте его для начала использования бота!',
noProfileText,
{ reply_markup: keyboard }
);
return;
@@ -129,9 +133,11 @@ export class CommandHandlers {
const profile = await this.profileService.getProfileByTelegramId(userId);
if (!profile) {
const createFirstText = await getUserTranslation(userId, 'profile.createFirst');
await this.bot.sendMessage(
msg.chat.id,
'❌ Сначала создайте профиль!\nИспользуйте команду /start'
createFirstText
);
return;
}

View File

@@ -6,13 +6,13 @@
},
"profile": {
"create": "Create Profile",
"edit": "Edit Profile",
"edit": "✏️ Edit",
"view": "View Profile",
"name": "Name",
"age": "Age",
"city": "City",
"bio": "About",
"photos": "Photos",
"photos": "📸 Photos",
"gender": "Gender",
"lookingFor": "Looking for",
"datingGoal": "Dating Goal",
@@ -29,7 +29,13 @@
"networking": "Networking",
"travel": "Travel",
"business": "Business",
"other": "Other"
"other": "Other",
"cityNotSpecified": "Not specified",
"bioNotSpecified": "No description provided",
"interests": "Interests",
"startSearch": "🔍 Start Search",
"noProfile": "❌ You don't have a profile yet.\nCreate one to start using the bot!",
"createFirst": "❌ Create a profile first!\nUse /start command"
},
"search": {
"title": "Browse Profiles",
@@ -97,5 +103,11 @@
"photoRequired": "Please add at least one photo",
"networkError": "Network error. Please try again later.",
"serverError": "Server error. Please try again later."
},
"common": {
"back": "👈 Back"
},
"matches": {
"noMatches": "✨ You don't have any matches yet.\n\n🔍 Try browsing more profiles!\nUse /browse to search."
}
}

94
src/locales/en_fixed.json Normal file
View File

@@ -0,0 +1,94 @@
{
"commands": {
"start": "🏠 Main menu",
"help": " Help",
"profile": "👤 My profile",
"search": "🔍 Browse profiles",
"matches": "💕 Matches",
"premium": "⭐ Premium",
"settings": "⚙️ Settings"
},
"menu": {
"main": "🏠 Main menu",
"back": "👈 Back",
"profile": "👤 Profile",
"search": "🔍 Browse",
"matches": "💕 Matches",
"premium": "⭐ Premium",
"settings": "⚙️ Settings"
},
"welcome": {
"newUser": "Welcome to Telegram Tinder Bot! 💕\\n\\nHere you can find interesting people for communication and dating.\\n\\nTo get started, create your profile!",
"existingUser": "Welcome back! 👋\\n\\nChoose an action:",
"createProfile": "🚀 Create profile"
},
"help": {
"title": "📋 How to use the bot:",
"step1": "1⃣ Create profile",
"step1Desc": " • Enter name, age, city\\n • Add description\\n • Upload photo",
"step2": "2⃣ Browse profiles",
"step2Desc": " • Swipe through other users' profiles\\n • Like (❤️) or dislike (👎)",
"step3": "3⃣ Get match",
"step3Desc": " • When two people like each other\\n • Chat becomes available",
"step4": "4⃣ Communication",
"step4Desc": " • Find common interests\\n • Arrange meetings",
"tipsTitle": "💡 Tips:",
"tips": "• Use quality photos\\n• Write interesting description\\n• Be polite in communication",
"createProfile": "🚀 Create profile"
},
"settings": {
"title": "⚙️ Settings",
"language": "🌐 Interface language",
"ageRange": "📅 Age range",
"showAge": "🎂 Show age",
"showCity": "📍 Show city",
"notifications": "🔔 Notifications",
"privacy": "🔒 Privacy",
"back": "👈 Back"
},
"languages": {
"ru": "🇷🇺 Русский",
"en": "🇺🇸 English",
"es": "🇪🇸 Español",
"fr": "🇫🇷 Français",
"de": "🇩🇪 Deutsch",
"it": "🇮🇹 Italiano",
"pt": "🇵🇹 Português",
"zh": "🇨🇳 中文",
"ja": "🇯🇵 日本語",
"ko": "🇰🇷 한국어",
"uz": "🇺🇿 O'zbekcha",
"kk": "🇰🇿 Қазақша"
},
"howItWorks": {
"title": "🤔 How does it work?",
"step1": "1⃣ Create profile",
"step1Desc": " • Enter name, age, city\\n • Add description\\n • Upload photo",
"step2": "2⃣ Browse profiles",
"step2Desc": " • Swipe through other users' profiles\\n • Like (❤️) or dislike (👎)",
"step3": "3⃣ Get match",
"step3Desc": " • When two people like each other\\n • Chat becomes available",
"step4": "4⃣ Communication",
"step4Desc": " • Find common interests\\n • Arrange meetings",
"tipsTitle": "💡 Tips:",
"tips": "• Use quality photos\\n• Write interesting description\\n• Be polite in communication",
"createProfile": "🚀 Create profile"
},
"noProfile": {
"message": "❌ You don't have a profile yet.\\nCreate one to start using the bot!",
"createButton": "🚀 Create profile"
},
"profileCreated": {
"success": "🎉 Profile created successfully!\\n\\nWelcome, {{name}}! 💖\\n\\nNow you can start searching for your soulmate!",
"myProfile": "👤 My profile",
"startSearch": "🔍 Start search"
},
"errors": {
"profileNotFound": "Profile not found",
"profileIncomplete": "Fill out the profile completely",
"ageInvalid": "Enter correct age (18-100)",
"photoRequired": "Add at least one photo",
"networkError": "Network error. Try later.",
"serverError": "Server error. Try later."
}
}

94
src/locales/es_fixed.json Normal file
View File

@@ -0,0 +1,94 @@
{
"commands": {
"start": "🏠 Menú principal",
"help": " Ayuda",
"profile": "👤 Mi perfil",
"search": "🔍 Buscar perfiles",
"matches": "💕 Matches",
"premium": "⭐ Premium",
"settings": "⚙️ Configuración"
},
"menu": {
"main": "🏠 Menú principal",
"back": "👈 Atrás",
"profile": "👤 Perfil",
"search": "🔍 Buscar",
"matches": "💕 Matches",
"premium": "⭐ Premium",
"settings": "⚙️ Configuración"
},
"welcome": {
"newUser": "¡Bienvenido a Telegram Tinder Bot! 💕\\n\\nAquí puedes encontrar personas interesantes para comunicarte y conocer.\\n\\n¡Para comenzar, crea tu perfil!",
"existingUser": "¡Bienvenido de vuelta! 👋\\n\\nElige una acción:",
"createProfile": "🚀 Crear perfil"
},
"help": {
"title": "📋 Cómo usar el bot:",
"step1": "1⃣ Crear perfil",
"step1Desc": " • Indica nombre, edad, ciudad\\n • Agrega descripción\\n • Sube una foto",
"step2": "2⃣ Navegar perfiles",
"step2Desc": " • Desliza por los perfiles de otros usuarios\\n • Dale me gusta (❤️) o no me gusta (👎)",
"step3": "3⃣ Obtener match",
"step3Desc": " • Cuando dos personas se gustan mutuamente\\n • Se habilita el chat",
"step4": "4⃣ Comunicación",
"step4Desc": " • Encuentra intereses comunes\\n • Organiza encuentros",
"tipsTitle": "💡 Consejos:",
"tips": "• Usa fotos de calidad\\n• Escribe una descripción interesante\\n• Sé educado en la comunicación",
"createProfile": "🚀 Crear perfil"
},
"settings": {
"title": "⚙️ Configuración",
"language": "🌐 Idioma de la interfaz",
"ageRange": "📅 Rango de edad",
"showAge": "🎂 Mostrar edad",
"showCity": "📍 Mostrar ciudad",
"notifications": "🔔 Notificaciones",
"privacy": "🔒 Privacidad",
"back": "👈 Atrás"
},
"languages": {
"ru": "🇷🇺 Русский",
"en": "🇺🇸 English",
"es": "🇪🇸 Español",
"fr": "🇫🇷 Français",
"de": "🇩🇪 Deutsch",
"it": "🇮🇹 Italiano",
"pt": "🇵🇹 Português",
"zh": "🇨🇳 中文",
"ja": "🇯🇵 日本語",
"ko": "🇰🇷 한국어",
"uz": "🇺🇿 O'zbekcha",
"kk": "🇰🇿 Қазақша"
},
"howItWorks": {
"title": "🤔 ¿Cómo funciona?",
"step1": "1⃣ Crear perfil",
"step1Desc": " • Indica nombre, edad, ciudad\\n • Agrega descripción\\n • Sube una foto",
"step2": "2⃣ Navegar perfiles",
"step2Desc": " • Desliza por los perfiles de otros usuarios\\n • Dale me gusta (❤️) o no me gusta (👎)",
"step3": "3⃣ Obtener match",
"step3Desc": " • Cuando dos personas se gustan mutuamente\\n • Se habilita el chat",
"step4": "4⃣ Comunicación",
"step4Desc": " • Encuentra intereses comunes\\n • Organiza encuentros",
"tipsTitle": "💡 Consejos:",
"tips": "• Usa fotos de calidad\\n• Escribe una descripción interesante\\n• Sé educado en la comunicación",
"createProfile": "🚀 Crear perfil"
},
"noProfile": {
"message": "❌ Aún no tienes un perfil.\\n¡Crea uno para empezar a usar el bot!",
"createButton": "🚀 Crear perfil"
},
"profileCreated": {
"success": "🎉 ¡Perfil creado exitosamente!\\n\\n¡Bienvenido, {{name}}! 💖\\n\\n¡Ahora puedes empezar a buscar tu media naranja!",
"myProfile": "👤 Mi perfil",
"startSearch": "🔍 Comenzar búsqueda"
},
"errors": {
"profileNotFound": "Perfil no encontrado",
"profileIncomplete": "Completa el perfil por completo",
"ageInvalid": "Ingresa edad correcta (18-100)",
"photoRequired": "Agrega al menos una foto",
"networkError": "Error de red. Intenta más tarde.",
"serverError": "Error del servidor. Intenta más tarde."
}
}

152
src/locales/kk.json Normal file
View File

@@ -0,0 +1,152 @@
{
"welcome": {
"greeting": "🎉 Telegram Tinder Botқа қош келдіңіз!\n\n💕 Мұнда сіз өзіңіздің жарыңызды таба аласыз!\n\nБастау үшін профиліңізді жасаңыз:",
"description": "Өзіңіздің жарыңызды осы жерден табыңыз!",
"getStarted": "Танысуды бастау",
"haveProfile": "🎉 Қош келдіңіз, {{name}}!\n\n💖 Telegram Tinder Bot жұмысқа дайын!\n\nНе істегіңіз келеді?"
},
"profile": {
"create": "Профиль жасау",
"edit": "Профильді өңдеу",
"view": "Профильді көру",
"name": "Аты",
"age": "Жасы",
"city": "Қала",
"bio": "Өзім туралы",
"photos": "Суреттер",
"gender": "Жынысы",
"lookingFor": "Іздеймін",
"datingGoal": "Танысу мақсаты",
"hobbies": "Хоббилер",
"lifestyle": "Өмір салты",
"male": "Ер",
"female": "Әйел",
"both": "Маңызды емес",
"relationship": "Серьезды қатынас",
"friendship": "Достық",
"dating": "Кездесулер",
"hookup": "Қысқа қатынас",
"marriage": "Неке",
"networking": "Қарым-қатынас",
"travel": "Саяхат",
"business": "Бизнес",
"other": "Басқа"
},
"search": {
"title": "Профильдерді іздеу",
"noProfiles": "Профильдер таусылды! Кейінірек көріңіз.",
"like": "👍 Ұнайды",
"dislike": "👎 Ұнамайды",
"superlike": "💖 Супер ұнайды",
"match": "Бұл өзара ұнау! 🎉",
"tryAgain": "🔄 Қайта көру",
"myMatches": "💕 Менің матчтарым",
"allViewed": "🎉 Сіз барлық қолжетімді кандидаттарды қарап шықтыңыз!\n\n⏰ Кейінірек көріңіз - жаңа профильдер пайда болуы мүмкін!",
"viewProfile": "👤 Профиль",
"morePhotos": "📸 Тағы суреттер",
"next": "⏭ Келесі",
"sendMessage": "💬 Хабар жазу",
"continueBrowsing": "🔍 Іздеуді жалғастыру",
"matchFound": "🎉 БҰЛ МАТЧ! 💕\n\n{{name}} пен өзара ұнадыңыз!\n\nЕнді сөйлесуді бастай аласыз!",
"noMoreProfiles": "😔 Қазір жаңа профильдер жоқ.\n\n⏰ Кейінірек қайта келуіңізге болады!"
},
"vip": {
"title": "⭐ VIP Іздеу",
"description": "Премиум мүмкіндіктермен іздеңіз!",
"features": "• Шексіз лайктар\n• Супер лайктар\n• Кімдер ұнатқанын көру\n• Жарнамасыз тәжірибе",
"getVip": "VIP алу",
"alreadyVip": "Сіз қазірдің өзінде VIP пайдаланушысыз!"
},
"translation": {
"inProgress": "🔄 Аударылуда...",
"completed": "✅ Аударма дайын!",
"failed": "❌ Аударма қатесі",
"error": "Аударма қатесі. Кейінірек көріңіз.",
"premiumOnly": "Аударма тек премиум пайдаланушылар үшін"
},
"commands": {
"start": "Басты мәзір",
"profile": "Менің профилім",
"search": "Іздеу",
"vip": "VIP іздеу",
"matches": "Өзара ұнатулар",
"premium": "Премиум",
"settings": "Баптаулар",
"help": "Көмек"
},
"buttons": {
"back": "« Артқа",
"next": "Келесі »",
"save": "Сақтау",
"cancel": "Бас тарту",
"confirm": "Растау",
"edit": "Өңдеу",
"delete": "Жою",
"yes": "Иә",
"no": "Жоқ"
},
"help": {
"title": "🤖 Telegram Tinder Bot - Көмек",
"commands": "📋 Қолжетімді командалар:",
"commandStart": "/start - Басты мәзір",
"commandProfile": "/profile - Профиль басқаруы",
"commandBrowse": "/browse - Профильдерді көру",
"commandMatches": "/matches - Сіздің матчтарыңыз",
"commandSettings": "/settings - Баптаулар",
"commandHelp": "/help - Осы көмек",
"howToUse": "📱 Қалай пайдалану:",
"step1": "1. Сурет пен сипаттамамен профиль жасаңыз",
"step2": "2. Басқа пайдаланушылардың профильдерін қараңыз",
"step3": "3. Ұнағандарға лайк басыңыз",
"step4": "4. Өзара ұнатқандармен сөйлесіңіз!",
"goodLuck": "❤️ Махаббат табуда сәттілік тілейміз!"
},
"settings": {
"title": "⚙️ Профиль баптаулары\n\nӨзгерткіңіз келетін нәрсені таңдаңыз:",
"searchSettings": "🔍 Іздеу баптаулары",
"notifications": "🔔 Хабарландырулар",
"language": "🌐 Интерфейс тілі",
"stats": "📊 Статистика",
"hideProfile": "🚫 Профильді жасыру",
"deleteProfile": "🗑 Профильді жою",
"searchComingSoon": "🔍 Іздеу баптаулары келесі жаңартуда болады!",
"notificationsComingSoon": "🔔 Хабарландыру баптаулары келесі жаңартуда болады!"
},
"howItWorks": {
"title": "🎯 Telegram Tinder Bot қалай жұмыс істейді?",
"step1Title": "1⃣ Профиль жасаңыз",
"step1Desc": " • Сурет пен сипаттама қосыңыз\n • Өзіңіздің қалауларыңызды белгілеңіз",
"step2Title": "2⃣ Профильдерді қараңыз",
"step2Desc": " • Ұнағандарға лайк басыңыз\n • Ерекше жағдайлар үшін супер лайк пайдаланыңыз",
"step3Title": "3⃣ Матчтар алыңыз",
"step3Desc": " • Лайкіңіз өзара болса - бұл матч!\n • Сөйлесуді бастаңыз",
"step4Title": "4⃣ Сөйлесіңіз және танысыңыз",
"step4Desc": " • Ортақ қызығушылықтарды табыңыз\n • Кездесуді жоспарлаңыз",
"tipsTitle": "💡 Кеңестер:",
"tips": "• Сапалы суреттер пайдаланыңыз\n• Қызықты сипаттама жазыңыз\n• Сөйлесуде сыпайы болыңыз",
"createProfile": "🚀 Профиль жасау"
},
"noProfile": {
"message": "❌ Сізде әлі профиль жоқ.\\nБотты пайдалану үшін профиль жасаңыз!",
"createButton": "🚀 Профиль жасау"
},
"noMatches": {
"message": "💔 Сізде әлі матчтар жоқ.\\n\\n🔍 Көбірек профильдерді қарап шығыңыз!\\nІздеу үшін /browse пайдаланыңыз."
},
"browsing": {
"needProfile": "❌ Алдымен профиль жасаңыз!\\n/start командасын пайдаланыңыз"
},
"profileCreated": {
"success": "🎉 Профиль сәтті жасалды!\n\nҚош келдіңіз, {{name}}! 💖\n\nЕнді сіз өзіңіздің жарыңызды іздеуді бастай аласыз!",
"myProfile": "👤 Менің профилім",
"startSearch": "🔍 Іздеуді бастау"
},
"errors": {
"profileNotFound": "Профиль табылмады",
"profileIncomplete": "Профильді толық толтырыңыз",
"ageInvalid": "Дұрыс жасты енгізіңіз (18-100)",
"photoRequired": "Кемінде бір сурет қосыңыз",
"networkError": "Желі қатесі. Кейінірек көріңіз.",
"serverError": "Сервер қатесі. Кейінірек көріңіз."
}
}

View File

@@ -6,13 +6,13 @@
},
"profile": {
"create": "Создать анкету",
"edit": "Редактировать анкету",
"edit": "✏️ Редактировать",
"view": "Посмотреть анкету",
"name": "Имя",
"age": "Возраст",
"city": "Город",
"bio": "О себе",
"photos": "Фотографии",
"photos": "📸 Фото",
"gender": "Пол",
"lookingFor": "Ищу",
"datingGoal": "Цель знакомства",
@@ -29,7 +29,13 @@
"networking": "Общение",
"travel": "Путешествия",
"business": "Бизнес",
"other": "Другое"
"other": "Другое",
"cityNotSpecified": "Не указан",
"bioNotSpecified": "Описание не указано",
"interests": "Интересы",
"startSearch": "🔍 Начать поиск",
"noProfile": "❌ У вас пока нет профиля.\nСоздайте его для начала использования бота!",
"createFirst": "❌ Сначала создайте профиль!\nИспользуйте команду /start"
},
"search": {
"title": "Поиск анкет",
@@ -97,5 +103,27 @@
"photoRequired": "Добавьте хотя бы одну фотографию",
"networkError": "Ошибка сети. Попробуйте позже.",
"serverError": "Ошибка сервера. Попробуйте позже."
},
"common": {
"back": "👈 Назад"
},
"matches": {
"noMatches": "✨ У вас пока нет матчей.\n\n🔍 Попробуйте просмотреть больше анкет!\nИспользуйте /browse для поиска."
},
"start": {
"welcomeBack": "🎉 С возвращением, {name}!\n\n💖 Telegram Tinder Bot готов к работе!\n\nЧто хотите сделать?",
"welcomeNew": "🎉 Добро пожаловать в Telegram Tinder Bot!\n\n💕 Здесь вы можете найти свою вторую половинку!\n\nДля начала создайте свой профиль:",
"myProfile": "👤 Мой профиль",
"browseProfiles": "🔍 Просмотр анкет",
"myMatches": "💕 Мои матчи",
"vipSearch": "⭐ VIP поиск",
"settings": "⚙️ Настройки",
"createProfile": "🚀 Создать профиль",
"howItWorks": " Как это работает?"
},
"help": {
"title": "🤖 Telegram Tinder Bot - Справка",
"description": "Бот для знакомств в Telegram\n\n📝 Создайте профиль\n🔍 Просматривайте анкеты\n❤ Ставьте лайки\n💕 Находите взаимности\n💬 Общайтесь в чатах",
"commands": "📋 Команды:\n/start - Главное меню\n/profile - Мой профиль\n/browse - Просмотр анкет\n/matches - Мои матчи\n/settings - Настройки\n/help - Эта справка"
}
}

94
src/locales/ru_fixed.json Normal file
View File

@@ -0,0 +1,94 @@
{
"commands": {
"start": "🏠 Главное меню",
"help": " Помощь",
"profile": "👤 Мой профиль",
"search": "🔍 Поиск анкет",
"matches": "💕 Матчи",
"premium": "⭐ Premium",
"settings": "⚙️ Настройки"
},
"menu": {
"main": "🏠 Главное меню",
"back": "👈 Назад",
"profile": "👤 Профиль",
"search": "🔍 Поиск",
"matches": "💕 Матчи",
"premium": "⭐ Premium",
"settings": "⚙️ Настройки"
},
"welcome": {
"newUser": "Добро пожаловать в Telegram Tinder Bot! 💕\n\nЗдесь вы сможете найти интересных людей для общения и знакомств.\n\nДля начала работы создайте свой профиль!",
"existingUser": "С возвращением! 👋\n\nВыберите действие:",
"createProfile": "🚀 Создать профиль"
},
"help": {
"title": "📋 Как пользоваться ботом:",
"step1": "1⃣ Создать профиль",
"step1Desc": " • Укажите имя, возраст, город\n • Добавьте описание\n • Загрузите фото",
"step2": "2⃣ Просматривать анкеты",
"step2Desc": " • Листайте профили других пользователей\n • Ставьте лайки (❤️) или дизлайки (👎)",
"step3": "3⃣ Получить матч",
"step3Desc": " • Когда два человека ставят лайки друг другу\n • Появляется возможность общения",
"step4": "4⃣ Общение",
"step4Desc": " • Находите общие интересы\n • Договаривайтесь о встрече",
"tipsTitle": "💡 Советы:",
"tips": "• Используйте качественные фото\n• Напишите интересное описание\n• Будьте вежливы в общении",
"createProfile": "🚀 Создать профиль"
},
"settings": {
"title": "⚙️ Настройки",
"language": "🌐 Язык интерфейса",
"ageRange": "📅 Возрастной диапазон",
"showAge": "🎂 Показывать возраст",
"showCity": "📍 Показывать город",
"notifications": "🔔 Уведомления",
"privacy": "🔒 Приватность",
"back": "👈 Назад"
},
"languages": {
"ru": "🇷🇺 Русский",
"en": "🇺🇸 English",
"es": "🇪🇸 Español",
"fr": "🇫🇷 Français",
"de": "🇩🇪 Deutsch",
"it": "🇮🇹 Italiano",
"pt": "🇵🇹 Português",
"zh": "🇨🇳 中文",
"ja": "🇯🇵 日本語",
"ko": "🇰🇷 한국어",
"uz": "🇺🇿 O'zbekcha",
"kk": "🇰🇿 Қазақша"
},
"howItWorks": {
"title": "🤔 Как это работает?",
"step1": "1⃣ Создать профиль",
"step1Desc": " • Укажите имя, возраст, город\n • Добавьте описание\n • Загрузите фото",
"step2": "2⃣ Просматривать анкеты",
"step2Desc": " • Листайте профили других пользователей\n • Ставьте лайки (❤️) или дизлайки (👎)",
"step3": "3⃣ Получить матч",
"step3Desc": " • Когда два человека ставят лайки друг другу\n • Появляется возможность общения",
"step4": "4⃣ Общение",
"step4Desc": " • Находите общие интересы\n • Договаривайтесь о встрече",
"tipsTitle": "💡 Советы:",
"tips": "• Используйте качественные фото\n• Напишите интересное описание\n• Будьте вежливы в общении",
"createProfile": "🚀 Создать профиль"
},
"noProfile": {
"message": "❌ У вас пока нет профиля.\\nСоздайте его для начала использования бота!",
"createButton": "🚀 Создать профиль"
},
"profileCreated": {
"success": "🎉 Профиль успешно создан!\\n\\nДобро пожаловать, {{name}}! 💖\\n\\nТеперь вы можете начать поиск своей второй половинки!",
"myProfile": "👤 Мой профиль",
"startSearch": "🔍 Начать поиск"
},
"errors": {
"profileNotFound": "Анкета не найдена",
"profileIncomplete": "Заполните анкету полностью",
"ageInvalid": "Введите корректный возраст (18-100)",
"photoRequired": "Добавьте хотя бы одну фотографию",
"networkError": "Ошибка сети. Попробуйте позже.",
"serverError": "Ошибка сервера. Попробуйте позже."
}
}

152
src/locales/uz.json Normal file
View File

@@ -0,0 +1,152 @@
{
"welcome": {
"greeting": "🎉 Telegram Tinder Botga xush kelibsiz!\n\n💕 Bu yerda siz o'zingizning hayot sherigigingizni topa olasiz!\n\nBoshlash uchun profilingizni yarating:",
"description": "O'zingizning hayot sherigigingizni shu yerda toping!",
"getStarted": "Tanishishni boshlash",
"haveProfile": "🎉 Xush kelibsiz, {{name}}!\n\n💖 Telegram Tinder Bot ishga tayyor!\n\nNima qilmoqchisiz?"
},
"profile": {
"create": "Profil yaratish",
"edit": "Profilni tahrirlash",
"view": "Profilni ko'rish",
"name": "Ism",
"age": "Yosh",
"city": "Shahar",
"bio": "O'zim haqimda",
"photos": "Rasmlar",
"gender": "Jins",
"lookingFor": "Qidiraman",
"datingGoal": "Tanishuv maqsadi",
"hobbies": "Sevimli mashg'ulotlar",
"lifestyle": "Turmush tarzi",
"male": "Erkak",
"female": "Ayol",
"both": "Muhim emas",
"relationship": "Jiddiy munosabatlar",
"friendship": "Do'stlik",
"dating": "Uchrashuvlar",
"hookup": "Qisqa munosabat",
"marriage": "Nikoh",
"networking": "Muloqot",
"travel": "Sayohat",
"business": "Biznes",
"other": "Boshqa"
},
"search": {
"title": "Profillarni qidirish",
"noProfiles": "Profillar tugadi! Keyinroq urinib ko'ring.",
"like": "👍 Yoqadi",
"dislike": "👎 Yoqmadi",
"superlike": "💖 Super yoqdi",
"match": "Bu o'zaro yoqish! 🎉",
"tryAgain": "🔄 Yana urinish",
"myMatches": "💕 Mening matchlarim",
"allViewed": "🎉 Siz barcha mavjud nomzodlarni ko'rib chiqdingiz!\n\n⏰ Keyinroq urinib ko'ring - yangi profillar paydo bo'lishi mumkin!",
"viewProfile": "👤 Profil",
"morePhotos": "📸 Yana rasmlar",
"next": "⏭ Keyingi",
"sendMessage": "💬 Xabar yozish",
"continueBrowsing": "🔍 Qidirishni davom ettirish",
"matchFound": "🎉 BU MATCH! 💕\n\n{{name}} bilan o'zaro yoqdingiz!\n\nEndi suhbatni boshlashingiz mumkin!",
"noMoreProfiles": "😔 Hozircha yangi profillar yo'q.\n\n⏰ Keyinroq qaytib kelishingiz mumkin!"
},
"vip": {
"title": "⭐ VIP Qidiruv",
"description": "Premium imkoniyatlar bilan qidiring!",
"features": "• Cheksiz yoqish\n• Super yoqishlar\n• Kimlar yoqganini ko'rish\n• Reklamasiz tajriba",
"getVip": "VIP olish",
"alreadyVip": "Siz allaqachon VIP foydalanuvchisiz!"
},
"translation": {
"inProgress": "🔄 Tarjima qilinmoqda...",
"completed": "✅ Tarjima tayyor!",
"failed": "❌ Tarjima xatosi",
"error": "Tarjima xatosi. Keyinroq urinib ko'ring.",
"premiumOnly": "Tarjima faqat premium foydalanuvchilar uchun"
},
"commands": {
"start": "Bosh menyu",
"profile": "Mening profilim",
"search": "Qidiruv",
"vip": "VIP qidiruv",
"matches": "O'zaro yoqishlar",
"premium": "Premium",
"settings": "Sozlamalar",
"help": "Yordam"
},
"buttons": {
"back": "« Orqaga",
"next": "Keyingi »",
"save": "Saqlash",
"cancel": "Bekor qilish",
"confirm": "Tasdiqlash",
"edit": "Tahrirlash",
"delete": "O'chirish",
"yes": "Ha",
"no": "Yo'q"
},
"help": {
"title": "🤖 Telegram Tinder Bot - Yordam",
"commands": "📋 Mavjud buyruqlar:",
"commandStart": "/start - Bosh menyu",
"commandProfile": "/profile - Profil boshqaruvi",
"commandBrowse": "/browse - Profillarni ko'rish",
"commandMatches": "/matches - Sizning matchlaringiz",
"commandSettings": "/settings - Sozlamalar",
"commandHelp": "/help - Ushbu yordam",
"howToUse": "📱 Qanday foydalanish:",
"step1": "1. Rasm va tavsif bilan profil yarating",
"step2": "2. Boshqa foydalanuvchilarning profillarini ko'ring",
"step3": "3. Yoqganlaringizga yoqish bosing",
"step4": "4. O'zaro yoqganlar bilan suhbatlashing!",
"goodLuck": "❤️ Sevgi topishda omad tilaymiz!"
},
"settings": {
"title": "⚙️ Profil sozlamalari\n\nO'zgartirmoqchi bo'lgan narsani tanlang:",
"searchSettings": "🔍 Qidiruv sozlamalari",
"notifications": "🔔 Bildirishnomalar",
"language": "🌐 Interfeys tili",
"stats": "📊 Statistika",
"hideProfile": "🚫 Profilni yashirish",
"deleteProfile": "🗑 Profilni o'chirish",
"searchComingSoon": "🔍 Qidiruv sozlamalari keyingi yangilanishda bo'ladi!",
"notificationsComingSoon": "🔔 Bildirishnoma sozlamalari keyingi yangilanishda bo'ladi!"
},
"howItWorks": {
"title": "🎯 Telegram Tinder Bot qanday ishlaydi?",
"step1Title": "1⃣ Profil yarating",
"step1Desc": " • Rasm va tavsif qo'shing\n • O'zingizning xohishlaringizni belgilang",
"step2Title": "2⃣ Profillarni ko'ring",
"step2Desc": " • Yoqganlaringizga yoqish bosing\n • Maxsus holatlar uchun super yoqish ishlating",
"step3Title": "3⃣ Matchlar oling",
"step3Desc": " • Yoqishingiz o'zaro bo'lsa - bu match!\n • Suhbatni boshlang",
"step4Title": "4⃣ Suhbatlashing va tanishing",
"step4Desc": " • Umumiy qiziqishlarni toping\n • Uchrashuvni rejalang",
"tipsTitle": "💡 Maslahatlar:",
"tips": "• Sifatli rasmlar ishlating\n• Qiziqarli tavsif yozing\n• Suhbatda xushmuomala bo'ling",
"createProfile": "🚀 Profil yaratish"
},
"noProfile": {
"message": "❌ Sizda hali profil yo'q.\\nBotdan foydalanish uchun profil yarating!",
"createButton": "🚀 Profil yaratish"
},
"noMatches": {
"message": "💔 Sizda hali matchlar yo'q.\\n\\n🔍 Ko'proq profillarni ko'rib chiqing!\\nQidiruv uchun /browse dan foydalaning."
},
"browsing": {
"needProfile": "❌ Avval profil yarating!\\n/start buyrug'idan foydalaning"
},
"profileCreated": {
"success": "🎉 Profil muvaffaqiyatli yaratildi!\n\nXush kelibsiz, {{name}}! 💖\n\nEndi siz o'zingizning hayot sherigigingizni qidirishni boshlashingiz mumkin!",
"myProfile": "👤 Mening profilim",
"startSearch": "🔍 Qidirishni boshlash"
},
"errors": {
"profileNotFound": "Profil topilmadi",
"profileIncomplete": "Profilni to'liq to'ldiring",
"ageInvalid": "To'g'ri yoshni kiriting (18-100)",
"photoRequired": "Kamida bitta rasm qo'shing",
"networkError": "Tarmoq xatosi. Keyinroq urinib ko'ring.",
"serverError": "Server xatosi. Keyinroq urinib ko'ring."
}
}

View File

@@ -1,6 +1,7 @@
import i18next from 'i18next';
import * as fs from 'fs';
import * as path from 'path';
import { pool } from '../database/connection';
export class LocalizationService {
private static instance: LocalizationService;
@@ -129,6 +130,22 @@ export class LocalizationService {
}
}
// Функция для получения персонализированного перевода пользователя
export const getUserTranslation = async (telegramId: string, key: string, options?: any): Promise<string> => {
try {
// Получаем язык пользователя из базы данных
const result = await pool.query('SELECT language FROM users WHERE telegram_id = $1', [telegramId]);
const userLanguage = result.rows[0]?.language || 'ru';
// Получаем перевод для языка пользователя
return LocalizationService.getInstance().getTranslation(key, userLanguage, options);
} catch (error) {
console.error('Error getting user translation:', error);
// Возвращаем перевод на русском языке по умолчанию
return LocalizationService.getInstance().getTranslation(key, 'ru', options);
}
};
// Функция-хелпер для быстрого доступа к переводам
export const t = (key: string, options?: any): string => {
return LocalizationService.getInstance().t(key, options);