Files
DeepTutor/deeptutor/core/response_languages.py
ZQR1101 ade2d4ab1a feat(settings): add Persian (fa) as a model reply language
Persian can now be chosen as the language the model replies in, reusing
the same response-language seam that ar/ru/es/ms/hi already use: the
shared SUPPORTED_RESPONSE_LANGUAGES set, the settings router Literal,
the prompt language directive, the normalize aliases, and the web
response-language options/union.

This is reply-only: the UI locale stays English, and no Persian
translation pack or RTL dashboard is introduced. That broader
localization is a separate, design-level follow-up.

Regenerated the contracts (openapi.json + api.ts) to reflect the router
enum change so contracts:check stays green.
2026-11-21 18:24:23 +08:00

34 lines
648 B
Python

"""Supported reply languages used by core turn-request validation."""
SUPPORTED_RESPONSE_LANGUAGES: tuple[str, ...] = (
"en",
"zh",
"zh-tw",
"ja",
"ko",
"es",
"fr",
"de",
"ru",
"pt",
"it",
"ar",
"pl",
"uk",
"ms",
"vi",
"tr",
"hi",
"hu",
"fa",
)
def validate_reply_language_override(value: str | None) -> str | None:
"""Validate an explicit session choice; ``None`` follows the account default."""
if value is None:
return None
if value not in SUPPORTED_RESPONSE_LANGUAGES:
raise ValueError("Unsupported reply language")
return value