Обновленный перевод сервера
This commit is contained in:
parent
4215a62b6c
commit
35225b90a1
11 changed files with 94 additions and 530 deletions
|
|
@ -140,15 +140,18 @@ async def export_wifi(translations: Translations = Depends(get_translations("api
|
|||
)
|
||||
|
||||
@router.post("/set_language")
|
||||
def set_language(locale: str, response: Response, request: Request):
|
||||
def set_language(locale: str, response: Response, translations: Translations = Depends(get_translations("api_v1"))):
|
||||
"""
|
||||
Устанавливает куку locale для смены языка пользователя.
|
||||
|
||||
Args:
|
||||
locale (str): Используемый язык.
|
||||
response (Response): Запрос.
|
||||
translations: Объект переводов текущего языка.
|
||||
|
||||
Returns:
|
||||
dict: Сообщение об успешной установке языка.
|
||||
"""
|
||||
translations = get_translations("api_v1")(request)
|
||||
lc_messages_path = os.path.join(os.path.dirname(__file__), '..', '..', 'locales', locale, 'LC_MESSAGES')
|
||||
if not os.path.isdir(lc_messages_path):
|
||||
raise HTTPException(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue