/lang command.
Supported Languages
TT-Bot currently supports 8 languages:Arabic
Code:
File:
arFile:
data/locale/ar.jsonEnglish
Code:
File:
Default language
enFile:
data/locale/en.jsonDefault language
Hindi
Code:
File:
hiFile:
data/locale/hi.jsonIndonesian
Code:
File:
idFile:
data/locale/id.jsonRussian
Code:
File:
ruFile:
data/locale/ru.jsonSomali
Code:
File:
soFile:
data/locale/so.jsonUkrainian
Code:
File:
ukFile:
data/locale/uk.jsonVietnamese
Code:
File:
viFile:
data/locale/vi.jsonLocale File Structure
Each language file (data/locale/*.json) contains translation key-value pairs:
data/locale/en.json
Required Keys
Every locale file must include these keys:Basic messages
Basic messages
lang_name- Language name with flag emojistart- Welcome messagesend_link_prompt- Prompt to send linklang_start- Language selection confirmationlang- Current language indicator
Error messages
Error messages
error- Generic errorlink_error- Invalid linkerror_deleted- Video deletederror_private- Private videoerror_region- Region blockederror_network- Network errorerror_rate_limit- Rate limit hiterror_too_long- Video too longerror_queue_full- Queue fullerror_instagram_not_found- Instagram not found
Status messages
Status messages
downloading- Download in progressprocessing- Processing imagesmaintenance- Bot maintenance
Interactive elements
Interactive elements
get_sound- Audio extraction buttonget_last_10- Last 10 images buttonget_all- All images buttontry_again_button- Retry buttonad_support_button- Ad support button
Content formatting
Content formatting
bot_tag- Bot branding tagresult- Video result formatresult_song- Audio result format
Inline mode
Inline mode
inline_start_bot- Enable inline modeinline_wrong_link- Invalid inline linkinline_download_video- Download video buttoninline_download_instagram- Download Instagram buttononly_video_supported- Inline limitation message
Features
Features
file_mode_on- File mode enabledfile_mode_off- File mode disabledvideo_upload_hint- Upload not supportednon_tiktok_link- Non-TikTok link errortiktok_links_only- TikTok-only message
Group chat
Group chat
not_admin- Not admin warninggroup_info- Group chat infogroup_warning- Group limitations
Loading System
Locale files are automatically loaded at startup (data/config.py:206):
locale dict contains all translations:
Usage in Code
Access translations using user’s language preference:Fallback to English
Always include fallback for missing translations:Adding a New Language
Follow these steps to add a new language:1. Create Locale File
Createdata/locale/XX.json where XX is the language code:
2. Translate Content
Edit the new file and translate all strings:data/locale/fr.json
3. Restart Bot
The new language is auto-detected on restart:4. Test Language Selection
Users can now select the new language:- Send
/langto bot - Select “Français🇫🇷”
- Verify messages appear in French
HTML Formatting
Locale strings support Telegram HTML formatting:<b>bold</b>- Bold text<i>italic</i>- Italic text<code>code</code>- Monospace code<a href='url'>text</a>- Hyperlink\n- Line break
String Interpolation
Use Python format strings for dynamic values:Testing Translations
1. Check All Keys Present
2. Test Format Strings
3. Validate JSON
Best Practices
Consistent tone
Consistent tone
Match the tone and style of the English version. If English is casual, keep translations casual.
Emoji usage
Emoji usage
Emojis are universal but check cultural appropriateness. Flags should match language region.
Format preservation
Format preservation
Keep HTML tags, placeholders (
{0}), and line breaks (\n) in the same positions.Link text
Link text
Translate link text but keep URLs unchanged:
<a href='t.me/ttgrab'>Translated text</a>Testing
Testing
Test all messages in-app before deploying. Some strings are only visible in error states.
Character encoding
Character encoding
Use UTF-8 encoding for all locale files. Test special characters display correctly.
User Language Preference
User language is stored in the database:en (English).
