Usage Example
Expression:
Translate("common.welcome", "Welcome", UserName)
Output (English): Welcome, Ahmed
Output (Arabic): ??????? ????
Interpolation:
Translate("order.status", "Order %{opt1} is %{opt2}", OrderId + "," + Status)
JSON File Structure
/locales/+-- default/¦ +-- en-US.json ? common translations (loaded at app start)¦ +-- ar-SA.json+-- dashboard/¦ +-- en-US.json ? screen-specific (lazy-loaded)¦ +-- ar-SA.json+-- profile/ +-- en-US.json +-- ar-SA.json
Key Features
Lazy Loading
Translations load per screen, not all at once. Only fetches what the user actually visits — faster initial load, lower memory.
Fallback Chain
If a translation is missing for the current locale, the library walks: fr-FR ? fr ? en-US ? en ? defaultValue. UI never breaks.
Strict JSON Validation
Supports pure flat ("a.b.c": "value") or pure nested ({ "a": { "b": { "c": "value" } } }) JSON. Mixed formats are caught at load time with clear error messages — no silent failures.
Cache-Busting
ResourceVersion parameter appends ?t=v1.3 to all fetch URLs. Change the version on deployment to invalidate browser cache.
i18n instance detection issue fixed