Skip to content

Commit

Permalink
✨ Feature: Fully supports Russian
Browse files Browse the repository at this point in the history
  • Loading branch information
yym68686 committed Jul 22, 2024
1 parent 964ca08 commit 760c727
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The ChatGPT Telegram Bot is a powerful Telegram bot that utilizes the latest GPT
- **Long Text Message Merging**: Automatically merges long text messages, breaking through Telegram's single message length limit.
- **Multi-user Dialogue Isolation**: Supports dialogue isolation and configuration isolation, allowing selection between multi-user and single-user modes.
- **Question Prediction**: Automatically generates follow-up questions, anticipating what users might ask next.
- **Multi-language Interface**: Supports Simplified Chinese, Traditional Chinese, and English interfaces.
- **Multi-language Interface**: Supports Simplified Chinese, Traditional Chinese, Russian and English interfaces.
- **Whitelist, Blacklist, and Admin Settings**: Supports setting up whitelists, blacklists, and administrators.
- **Inline Mode**: Allows users to @ the bot in any chat window to generate answers without needing to ask questions in the bot's chat window.
- **User-friendly Interface**: Allows flexible model switching within the chat window and supports streaming output for a typewriter-like effect.Supports precise Markdown rendering of messages, utilizing another [project](https://github.com/yym68686/md2tgmd) of mine.
Expand Down
2 changes: 2 additions & 0 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,8 @@ async def start(update, context): # 当用户输入/start时,返回文本
update_language_status("Simplified Chinese", chat_id=convo_id)
elif user.language_code == "zh-hant":
update_language_status("Traditional Chinese", chat_id=convo_id)
elif user.language_code == "ru":
update_language_status("Russian", chat_id=convo_id)
else:
update_language_status("English", chat_id=convo_id)
message = (
Expand Down
2 changes: 2 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@
"English": False,
"Simplified Chinese": False,
"Traditional Chinese": False,
"Russian": False,
}

LANGUAGES_TO_CODE = {
"English": "en",
"Simplified Chinese": "zh",
"Traditional Chinese": "zh-hk",
"Russian": "ru",
}

current_date = datetime.now()
Expand Down
55 changes: 55 additions & 0 deletions utils/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,86 +3,109 @@
"zh": "欢迎",
"en": "Welcome",
"zh-hk": "歡迎",
"ru": "Добро пожаловать",
},
"button_change_model": {
"zh": "切换模型",
"en": "Change model",
"zh-hk": "切換模型",
"ru": "Сменить модель",
},
"button_preferences": {
"zh": "偏好设置",
"en": "Preferences",
"zh-hk": "偏好設定",
"ru": "Настройки",
},
"button_language": {
"zh": "🇨🇳 中文",
"en": "🇺🇸 English",
"zh-hk": "🇭🇰 繁体中文",
"ru": "🇷🇺 Русский",
},
"button_plugins": {
"zh": "插件",
"en": "Plugins",
"zh-hk": "插件",
"ru": "Плагины",
},
"button_back": {
"zh": "⬅️ 返回",
"en": "⬅️ Back",
"zh-hk": "⬅️ 返回",
"ru": "⬅️ Назад",
},
"English": {
"zh": "🇺🇸 英文",
"en": "🇺🇸 English",
"zh-hk": "🇺🇸 英文",
"ru": "🇺🇸 Английский",
},
"Simplified Chinese": {
"zh": "🇨🇳 中文",
"en": "🇨🇳 Simplified Chinese",
"zh-hk": "🇨🇳 簡體中文",
"ru": "🇨🇳 Китайский",
},
"Traditional Chinese": {
"zh": "🇭🇰 繁体中文",
"en": "🇭🇰 Traditional Chinese",
"zh-hk": "🇭🇰 繁體中文",
"ru": "🇭🇰 Китайский",
},
"Russian": {
"zh": "🇷🇺 俄语",
"en": "🇷🇺 Russian",
"zh-hk": "🇷🇺 俄語",
"ru": "🇷🇺 Русский",
},
"PASS_HISTORY": {
"zh": "历史记录",
"en": "Chat history",
"zh-hk": "歷史記錄",
"ru": "История чата",
},
"FOLLOW_UP": {
"zh": "猜你想问",
"en": "Question suggestions",
"zh-hk": "猜你想問",
"ru": "Предложения вопросов",
},
"LONG_TEXT": {
"zh": "长文本合并",
"en": "Long text merge",
"zh-hk": "長文本合併",
"ru": "Слияние длинного текста",
},
"LONG_TEXT_SPLIT": {
"zh": "长文本分割",
"en": "Long text split",
"zh-hk": "長文本分割",
"ru": "Разделение длинного текста",
},
"FILE_UPLOAD_MESS": {
"zh": "提醒消息",
"en": "Reminder message",
"zh-hk": "提醒消息",
"ru": "Сообщение-напоминание",
},
"TITLE": {
"zh": "模型标题",
"en": "Model title",
"zh-hk": "模型标题",
"ru": "Название модели",
},
"TYPING": {
"zh": "输入状态",
"en": "Typing state",
"zh-hk": "輸入狀態",
"ru": "Состояние ввода",
},
"REPLY": {
"zh": "回复消息",
"en": "Reply message",
"zh-hk": "回覆消息",
"ru": "Сообщение ответа",
},
# "message_think": {
# "zh": "`...`",
Expand All @@ -93,56 +116,67 @@
"zh": "`思考中💭`",
"en": "`thinking💭`",
"zh-hk": "`思考中💭`",
"ru": "`думает💭`",
},
"message_banner": {
"zh": "👇 下面可以随时更改默认模型:",
"en": "👇 Change model below:",
"zh-hk": "👇 下面可以隨時更改默認模型:",
"ru": "👇 Измените модель ниже:",
},
"SEARCH": {
"zh": "搜索",
"en": "Search",
"zh-hk": "搜索",
"ru": "Поиск",
},
"URL": {
"zh": "网址总结",
"en": "URL summary",
"zh-hk": "網址總結",
"ru": "Сводка URL",
},
"DATE": {
"zh": "当前时间",
"en": "Current time",
"zh-hk": "當前時間",
"ru": "Текущее время",
},
"VERSION": {
"zh": "版本信息",
"en": "Version info",
"zh-hk": "版本信息",
"ru": "Информация о версии",
},
"TARVEL": {
"zh": "旅行信息",
"en": "Travel info",
"zh-hk": "旅行信息",
"ru": "Информация о поездках",
},
"FLIGHT": {
"zh": "航班价格",
"en": "Flight price",
"zh-hk": "航班價格",
"ru": "Цена на рейс",
},
"IMAGE": {
"zh": "DALL·E 3",
"en": "DALL·E 3",
"zh-hk": "DALL·E 3",
"ru": "DALL·E 3",
},
"CODE": {
"zh": "代码执行",
"en": "Code execution",
"zh-hk": "代碼執行",
"ru": "Выполнение кода",
},
"ARXIV": {
"zh": "ArXiv 论文",
"en": "ArXiv paper",
"zh-hk": "ArXiv 論文",
"ru": "Статья ArXiv",
},
"message_api_none": {
"zh": (
Expand All @@ -166,6 +200,13 @@
"如果您使用的是第三方API密鑰,請使用以下命令:\n\n"
"`/start https://your_api_url your_api_key`"
),
"ru": (
"Пожалуйста, установите ключ API, используя команду /start, вы можете просто скопировать следующий пример:\n\n"
"Если у вас есть официальный ключ API OpenAI, используйте следующую команду:\n\n"
"`/start your_api_key`\n\n"
"Если вы используете сторонний ключ API, используйте следующую команду:\n\n"
"`/start https://your_api_url your_api_key`"
),
},
"message_api_error": {
"zh": (
Expand All @@ -189,40 +230,54 @@
"如果您使用的是第三方API密鑰,請使用以下命令:\n\n"
"`/start https://your_api_url your_api_key`"
),
"ru": (
"Введенный вами ключ API или URL API недействителен, пожалуйста, сбросьте ключ API, используя команду /start, вы можете просто скопировать следующий пример:\n\n"
"Если у вас есть официальный ключ API OpenAI, используйте следующую команду:\n\n"
"`/start your_api_key`\n\n"
"Если вы используете сторонний ключ API, используйте следующую команду:\n\n"
"`/start https://your_api_url your_api_key`"
),
},
"message_command_text_none": {
"zh": "请在命令后面放入文本",
"en": "Please enter text after the command",
"zh-hk": "請在命令後面放入文本",
"ru": "Пожалуйста, введите текст после команды",
},
"message_reset": {
"zh": "重置成功!",
"en": "Reset successfully!",
"zh-hk": "重置成功!",
"ru": "Сброс успешно!",
},
"message_doc": {
"zh": "上传成功!",
"en": "Upload successfully!",
"zh-hk": "上傳成功!",
"ru": "Загрузка успешно!",
},
"message_search_stage_1": {
"zh": "🌐 正在搜索您的问题,提取关键词...",
"en": "🌐 Searching your question, extracting keywords...",
"zh-hk": "🌐 正在搜索您的問題,提取關鍵詞...",
"ru": "🌐 Поиск вашего вопроса, извлечение ключевых слов...",
},
"message_search_stage_2": {
"zh": "🌐 正在网上挑选最相关的信息源,请稍候...",
"en": "🌐 Selecting the most relevant information sources online, please wait...",
"zh-hk": "🌐 正在網上挑選最相關的信息源,請稍候...",
"ru": "🌐 Выбор наиболее релевантных источников информации онлайн, пожалуйста, подождите...",
},
"message_search_stage_3": {
"zh": "🌐 已找到一些有用的链接,正在获取详细内容...",
"en": "🌐 Some useful links have been found, getting detailed content...",
"zh-hk": "🌐 已找到一些有用的鏈接,正在獲取詳細內容...",
"ru": "🌐 Найдены некоторые полезные ссылки, получение подробного содержания...",
},
"message_search_stage_4": {
"zh": "🌐 快完成了✅,正在为您整理搜索结果...",
"en": "🌐 Almost done✅, organizing search results for you...",
"zh-hk": "🌐 快完成了✅,正在為您整理搜索結果...",
"ru": "🌐 Почти готово✅, организация результатов поиска для вас...",
},
}

0 comments on commit 760c727

Please sign in to comment.