mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-02 08:12:21 -07:00
feat: implement languages endpoint and refactor language handling to use languages.json
This commit is contained in:
@@ -1031,6 +1031,41 @@ class GetSettingResponse(BaseResponse):
|
||||
value: Any = Field(None, description="The setting value")
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# LANGUAGES SCHEMAS
|
||||
# =============================================================================
|
||||
|
||||
|
||||
class LanguageEntry(BaseModel):
|
||||
"""A single supported language entry."""
|
||||
model_config = ConfigDict(extra="allow")
|
||||
|
||||
code: str = Field(..., description="ISO language code (e.g. 'en_us')")
|
||||
display: str = Field(..., description="Human-readable display name (e.g. 'English (en_us)')")
|
||||
|
||||
|
||||
class LanguagesResponse(BaseResponse):
|
||||
"""Response for GET /languages — the canonical language registry."""
|
||||
model_config = ConfigDict(
|
||||
extra="allow",
|
||||
json_schema_extra={
|
||||
"examples": [{
|
||||
"success": True,
|
||||
"default": "en_us",
|
||||
"count": 20,
|
||||
"languages": [
|
||||
{"code": "en_us", "display": "English (en_us)"},
|
||||
{"code": "de_de", "display": "German (de_de)"}
|
||||
]
|
||||
}]
|
||||
}
|
||||
)
|
||||
|
||||
default: str = Field(..., description="Default/fallback language code")
|
||||
count: int = Field(..., description="Total number of supported languages")
|
||||
languages: List[LanguageEntry] = Field(..., description="All supported languages")
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# GRAPHQL SCHEMAS
|
||||
# =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user