15 lines
510 B
Python
15 lines
510 B
Python
from __future__ import annotations
|
|
|
|
DEFAULT_KB_LANGUAGE = "ru"
|
|
SUPPORTED_KB_LANGUAGES = {"ru", "kz"}
|
|
|
|
|
|
def normalize_kb_language(value: str | None) -> str:
|
|
normalized = str(value or DEFAULT_KB_LANGUAGE).strip().lower()
|
|
return normalized if normalized in SUPPORTED_KB_LANGUAGES else DEFAULT_KB_LANGUAGE
|
|
|
|
|
|
def resolve_article_group_id(article_id: str, article_group_id: str | None) -> str:
|
|
normalized_group = str(article_group_id or "").strip()
|
|
return normalized_group or str(article_id).strip()
|