2026.06.04 frontend építés közben

This commit is contained in:
Roo
2026-06-04 07:26:22 +00:00
parent 7adf6cc3e3
commit 59a30ac428
3302 changed files with 24091 additions and 1771 deletions

View File

@@ -35,11 +35,21 @@ class TranslationService:
logger.info(f"🌍 i18n Motor: {len(translations)} szöveg aktiválva a memóriában.")
@classmethod
def get_text(cls, key: str, lang: str = "hu", variables: Optional[Dict[str, Any]] = None) -> str:
def get_text(cls, key: str, lang: Optional[str] = None, variables: Optional[Dict[str, Any]] = None) -> str:
"""
Szerveroldali lekérés Fallback (EN) logikával és változó behelyettesítéssel.
Automatikusan használja a request context locale-ját, ha nincs explicit nyelv megadva.
Példa: get_text("AUTH.WELCOME", "hu", {"name": "Péter"})
"""
# Use context locale if no explicit language is provided
if lang is None:
try:
from app.core.context import get_current_locale
lang = get_current_locale()
except (ImportError, Exception):
# Fallback to default if context is not available
lang = "hu"
# 1. Kért nyelv lekérése
text = cls._published_cache.get(lang, {}).get(key)