2024-02-01 18:11:57 +08:00
|
|
|
|
2024-01-23 21:14:53 +08:00
|
|
|
|
2024-06-15 21:01:03 +08:00
|
|
|
languages = ['en-US', 'zh-Hans', 'zh-Hant', 'pt-BR', 'es-ES', 'fr-FR', 'de-DE', 'ja-JP', 'ko-KR', 'ru-RU', 'it-IT', 'uk-UA', 'vi-VN', 'pl-PL', 'hi-IN']
|
2024-01-23 21:14:53 +08:00
|
|
|
|
|
|
|
language_timezone_mapping = {
|
|
|
|
'en-US': 'America/New_York',
|
|
|
|
'zh-Hans': 'Asia/Shanghai',
|
2024-04-26 21:10:23 +08:00
|
|
|
'zh-Hant': 'Asia/Taipei',
|
2024-01-23 21:14:53 +08:00
|
|
|
'pt-BR': 'America/Sao_Paulo',
|
|
|
|
'es-ES': 'Europe/Madrid',
|
|
|
|
'fr-FR': 'Europe/Paris',
|
|
|
|
'de-DE': 'Europe/Berlin',
|
|
|
|
'ja-JP': 'Asia/Tokyo',
|
|
|
|
'ko-KR': 'Asia/Seoul',
|
|
|
|
'ru-RU': 'Europe/Moscow',
|
|
|
|
'it-IT': 'Europe/Rome',
|
2024-02-19 13:11:23 +08:00
|
|
|
'uk-UA': 'Europe/Kyiv',
|
2024-03-13 15:54:47 +08:00
|
|
|
'vi-VN': 'Asia/Ho_Chi_Minh',
|
2024-05-14 17:48:24 +08:00
|
|
|
'ro-RO': 'Europe/Bucharest',
|
2024-05-07 15:41:57 +08:00
|
|
|
'pl-PL': 'Europe/Warsaw',
|
2024-06-15 21:01:03 +08:00
|
|
|
'hi-IN': 'Asia/Kolkata'
|
2024-01-23 21:14:53 +08:00
|
|
|
}
|
|
|
|
|
2024-02-19 13:11:23 +08:00
|
|
|
|
2024-01-23 21:14:53 +08:00
|
|
|
def supported_language(lang):
|
|
|
|
if lang in languages:
|
|
|
|
return lang
|
|
|
|
|
|
|
|
error = ('{lang} is not a valid language.'
|
|
|
|
.format(lang=lang))
|
|
|
|
raise ValueError(error)
|