""" Internationalization module for the Lichess Telegram Bot English language only """ from typing import Optional # Translation dictionary (English only) TRANSLATIONS = { 'en': { # Start command 'start_message': ( "The bot tracks one or more players on Lichess.\n" "It shows ratings, daily, yesterday and weekly activity.\n" "When specifying a user_token (with puzzle read permission), you can also get puzzle data.\n" "The bot supports automatic checks at specified intervals and sends a report if there was activity during that time.\n\n" "Example for a week:\n" "🧩 Puzzles: 114 (āœ… 81 - āŒ 33)\n\n" "šŸ”„ Blitz — 5 games • šŸ”“ -10\n" "Rating: 2245\n" "āœ… Wins: 1\n" "āŒ Losses: 3\n" "šŸ¤ Draws: 1\n\n" "šŸ‡ Rapid — 19 games • 🟢 +20\n" "Rating: 2248\n" "āœ… Wins: 8\n" "āŒ Losses: 4\n" "šŸ¤ Draws: 7\n\n" "šŸ“‹ Available commands:\n" "/addgamer - Add a Lichess player to track (username only)\n" "/addtoken - Add a player with a token to get puzzle data\n" "/getgamers - Select active player (for which /today and other commands will work)\n" "/delgamer - Remove a player from the tracked list\n" "/today - Statistics for today\n" "/yesterday - Statistics for yesterday\n" "/week - Statistics for the week\n" "/lastYear_or_1000games - Statistics for the last year or last 1000 rated games (whichever comes first)\n" "/setperiod - Set up periodic notifications for the active player\n" "(active player changes in the /getgamers menu)\n" "/support - Contact the developer for support and feedback" ), # Add gamer commands 'addgamer_prompt': "šŸ‘¤ Enter the Lichess username of the player to track:", 'addtoken_prompt': ( "šŸ”‘ Enter the Lichess API token to get puzzle data.\n" "The token is created in profile settings — give it only puzzle:read permission.\n" "After that, the player corresponding to this token will be added." ), 'token_added': "āœ… Token added for player {username}!", 'gamer_added_with_token': "āœ… Player {username} added with token!", 'gamer_added': "āœ… Player {username} successfully added!\n\nTo add another player, use /addgamer", 'invalid_token': "āŒ Invalid token. Please try again.", 'token_username_error': "āŒ Failed to get username from token. Please try again.", 'empty_username': "āŒ Username cannot be empty. Please try again.", 'user_not_found': "āŒ Player {username} not found on Lichess. Check the spelling of the name.", # Get gamers 'no_gamers': "šŸ“­ No players in database. Use /addgamer to add.", 'loading_ratings': "šŸ”„ Loading player ratings...", 'select_active_gamer': "šŸ‘„ Select active player:\n\n", 'active_gamer_set': "āœ… Active player: {username}", 'gamer_not_found': "āŒ Player not found", # Delete gamer 'no_gamers_to_delete': "šŸ“­ You have no tracked players.", 'loading_gamers': "šŸ”„ Loading player list...", 'select_gamer_to_delete': "šŸ—‘ļø Select player to delete:\n\n", 'gamer_deleted': "āœ… Player {username} removed from tracked list.", 'active_gamer_deleted': "āœ… Player {username} removed from tracked list.\n\nāš ļø You deleted the active player. Use the /getgamers command to select a player for which the /today, /yesterday, /week commands will work.", 'last_gamer_deleted': "āœ… Player {username} removed from tracked list.\n\nāš ļø You deleted the last player. Use the /addgamer command to add a new tracked player.", 'delete_failed': "āŒ Failed to delete player", # Stats commands 'no_active_gamer': "āŒ No active player. Use /getgamers to select.", 'unknown_period': "āŒ Unknown period", 'no_data': "šŸ“­ No data", 'stats_title': "šŸ“Š Statistics {username} • {date_range}\n\n", 'puzzles_section': "🧩 Puzzles: {total} (āœ… {solved} - āŒ {unsolved})\n\n", 'games_section': "{emoji} {game_type} — {games_count} games • {rating_change}\nRating: {rating}\nāœ… Wins: {wins}\nāŒ Losses: {losses}\nšŸ¤ Draws: {draws}\n\n", # Set period 'select_gamer_for_period': "ā±ļø Select player to set notification period:\n\n", 'select_period': "ā±ļø Select period for player {username}:\nšŸ“± Notifications will be sent to personal messages", 'notifications_disabled': "āœ… Notifications disabled for {username}", 'period_set': "āœ… Period {period} minutes set for {username}\nšŸ“± Notifications will be sent to personal messages", 'disable_notifications': "āŒ Disable notifications", 'period_minutes': "ā° {period} minutes", # Period notification 'period_1_minute': "for 1 minute", 'period_2_3_4_minutes': "for {period} minutes", 'period_minutes_text': "for {period} minutes", 'period_notification_title': "šŸ“Š Statistics {username} • {period_text}\n\n", 'period_puzzles_section': "🧩 Puzzles: {total} (āœ… {solved} - āŒ {failed})\n\n", 'period_games_section': "{emoji} {game_type} — {games_count} games • {rating_change}\nRating: {rating}\nāœ… Wins: {wins}\nāŒ Losses: {losses}\nšŸ¤ Draws: {draws}\n\n", 'no_activity': "šŸ“­ No activity for this period", # Last year or 1000 games 'last_year_1000_processing': "ā³ Processing request... This may take a while as requests are very slow.", 'last_year_1000_player_processing': "šŸ”„ Requesting data for player {username}...", # Stats commands (today/yesterday/week) 'stats_processing': "ā³ Processing request...", 'stats_player_processing': "šŸ”„ Requesting data for player {username}...", 'stats_all_done': "āœ… That's all", # Support 'support_message': ( "šŸ’¬ Support & Feedback\n\n" "You can write to the service developer directly and report a problem, suggest new features, or ask a question.\n\n" "I will be happy to review every message and respond to it.\n\n" "The developer accepts messages in English and Russian languages.\n\n" "šŸ“§ Contact: @vrubelr\n\n" "šŸ“¦ Bot version: {version}" ), # Common 'period_minutes_suffix': "m", } } def get_user_language(update) -> str: """ Always return English language. """ return 'en' def t(key: str, lang: str = 'en', **kwargs) -> str: """ Translate a key (always English). Args: key: Translation key lang: Language code (ignored, always uses English) **kwargs: Format arguments for the translation string Returns: Translated string with formatted arguments """ translation = TRANSLATIONS['en'].get(key, key) # Format the string if kwargs provided if kwargs: try: return translation.format(**kwargs) except KeyError: # If formatting fails, return the translation as-is return translation return translation def get_lang_from_update(update) -> str: """ Always return English. """ return 'en'