Features: 1) Updated Russian translations for UI terms like "Dashboard" → "Панель", "Blogposts" → "Посты", etc.; 2) Added support for multiple locale directories in LOCALE_PATHS; 3) Introduced LANGUAGE_URL_OVERRIDES for URL language normalization.
Fixes: 1) Fixed case sensitivity in region code normalization (lowercase regions); 2) Corrected translation file updates to match new string values. Extra: 1) Refactored middleware to normalize language codes to lowercase; 2) Added new locale paths for engine modules; 3) Improved consistency in translation keys and fallbacks.
This commit is contained in:
parent
65002671cf
commit
efa21cf9c0
4 changed files with 17 additions and 7 deletions
Binary file not shown.
|
|
@ -235,7 +235,7 @@ msgstr "Меню"
|
|||
|
||||
#: evibes/settings/unfold.py:67
|
||||
msgid "Dashboard"
|
||||
msgstr "Приборная панель"
|
||||
msgstr "Панель"
|
||||
|
||||
#: evibes/settings/unfold.py:72
|
||||
msgid "Health"
|
||||
|
|
@ -255,7 +255,7 @@ msgstr "Группы"
|
|||
|
||||
#: evibes/settings/unfold.py:92
|
||||
msgid "Products"
|
||||
msgstr "Продукция"
|
||||
msgstr "Товары"
|
||||
|
||||
#: evibes/settings/unfold.py:97
|
||||
msgid "Categories"
|
||||
|
|
@ -267,15 +267,15 @@ msgstr "Бренды"
|
|||
|
||||
#: evibes/settings/unfold.py:107
|
||||
msgid "Blogposts"
|
||||
msgstr "Записи в блогах"
|
||||
msgstr "Посты"
|
||||
|
||||
#: evibes/settings/unfold.py:112
|
||||
msgid "Periodic Tasks"
|
||||
msgstr "Периодические задания"
|
||||
msgstr "Периодические задачи"
|
||||
|
||||
#: evibes/settings/unfold.py:137
|
||||
msgid "Taskboard"
|
||||
msgstr "Доска задач"
|
||||
msgstr "Канбан"
|
||||
|
||||
#: evibes/settings/unfold.py:142
|
||||
msgid "Support"
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ class CustomLocaleMiddleware(LocaleMiddleware):
|
|||
parts = lang.replace("_", "-").split("-")
|
||||
if len(parts) == 2:
|
||||
lang_code = parts[0].lower()
|
||||
region = parts[1].upper()
|
||||
region = parts[1].lower()
|
||||
normalized = f"{lang_code}-{region}"
|
||||
else:
|
||||
normalized = lang
|
||||
normalized = lang.lower()
|
||||
|
||||
translation.activate(normalized)
|
||||
request.LANGUAGE_CODE = normalized
|
||||
|
|
|
|||
|
|
@ -211,6 +211,14 @@ TEMPLATES: list[dict[str, str | list[str | Path] | dict[str, str | list[str]] |
|
|||
|
||||
USE_I18N: bool = True
|
||||
|
||||
LOCALE_PATHS: tuple[Path, ...] = (
|
||||
(BASE_DIR / "evibes/locale"),
|
||||
(BASE_DIR / "engine/blog/locale"),
|
||||
(BASE_DIR / "engine/core/locale"),
|
||||
(BASE_DIR / "engine/payments/locale"),
|
||||
(BASE_DIR / "engine/vibes_auth/locale"),
|
||||
)
|
||||
|
||||
LANGUAGES: tuple[tuple[str, str], ...] = (
|
||||
("ar-ar", "العربية"),
|
||||
("cs-cz", "Česky"),
|
||||
|
|
@ -301,6 +309,8 @@ CURRENCIES_WITH_SYMBOLS: tuple[tuple[str, str], ...] = (
|
|||
("VND", "₫"),
|
||||
)
|
||||
|
||||
LANGUAGE_URL_OVERRIDES: dict[str, str] = {code.split("-")[0]: code for code, _ in LANGUAGES if "-" in code}
|
||||
|
||||
CURRENCY_CODE: str = dict(CURRENCIES_BY_LANGUAGES).get(LANGUAGE_CODE) # type: ignore[assignment]
|
||||
|
||||
MODELTRANSLATION_FALLBACK_LANGUAGES: tuple[str, ...] = (LANGUAGE_CODE, "en-us", "de-de")
|
||||
|
|
|
|||
Loading…
Reference in a new issue