Some checks failed
Windows project source guards / test (push) Has been cancelled
A mode is a preset or up to three levels joined by + («Свой порядок…» dialog); levels nest, a collapsed folder hides what is below it, folders are indented and country/server folders show the flag. "Server" is read from the provider's own name (profiles/server_naming.py): the owner's 1455 vpnbot keys fall into 38 servers. Country headers name the country. Tests use the owner's real names (tests/fixtures/real_server_names.json, IPs masked). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
25 lines
2.1 KiB
Python
25 lines
2.1 KiB
Python
"""Country names for the group headers of the server list (a code like «DE» says little; «Германия» does)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
_NAMES = {
|
|
"DE": "Германия", "NL": "Нидерланды", "FI": "Финляндия", "SE": "Швеция", "PL": "Польша", "US": "США",
|
|
"GB": "Великобритания", "UK": "Великобритания", "FR": "Франция", "RU": "Россия", "CZ": "Чехия", "EE": "Эстония",
|
|
"LV": "Латвия", "LT": "Литва", "RO": "Румыния", "BG": "Болгария", "TR": "Турция", "KZ": "Казахстан",
|
|
"UA": "Украина", "BY": "Беларусь", "AM": "Армения", "GE": "Грузия", "AZ": "Азербайджан", "IL": "Израиль",
|
|
"AE": "ОАЭ", "IN": "Индия", "JP": "Япония", "KR": "Южная Корея", "SG": "Сингапур", "HK": "Гонконг",
|
|
"TW": "Тайвань", "CA": "Канада", "CH": "Швейцария", "AT": "Австрия", "IT": "Италия", "ES": "Испания",
|
|
"PT": "Португалия", "NO": "Норвегия", "DK": "Дания", "IE": "Ирландия", "BE": "Бельгия", "LU": "Люксембург",
|
|
"HU": "Венгрия", "SK": "Словакия", "SI": "Словения", "HR": "Хорватия", "RS": "Сербия", "GR": "Греция",
|
|
"CY": "Кипр", "MD": "Молдова", "KG": "Киргизия", "UZ": "Узбекистан", "AU": "Австралия", "BR": "Бразилия",
|
|
"MX": "Мексика", "AR": "Аргентина", "ZA": "ЮАР", "EG": "Египет", "MK": "Северная Македония", "EU": "Европа",
|
|
"IS": "Исландия", "MT": "Мальта", "AL": "Албания", "BA": "Босния и Герцеговина", "ME": "Черногория",
|
|
}
|
|
|
|
|
|
def country_title(code: str) -> str:
|
|
"""«Германия» for ``DE``; an unknown code is shown as it is, an empty one as «Страна не определена»."""
|
|
value = str(code or "").strip().upper()
|
|
if not value:
|
|
return "Страна не определена"
|
|
return _NAMES.get(value, value)
|