SurfSense/surfsense_web/contexts
SohamBhattacharjee2003 d5f46dd7de perf: implement dynamic locale loading and remove unused zod import
Replace static imports of all 5 locale JSON files with dynamic imports.
Only English is bundled by default, other locales (es, hi, pt, zh) load
on demand when the user switches languages.

Also removes unused 'set' import from zod (line 5) that was dragging
Zod surface into this module unnecessarily.

Changes:
- Removed static imports for es, hi, pt, zh locale files
- Removed unused zod import
- Added loadMessages() function for dynamic locale loading
- Updated setLocale() to load messages asynchronously
- Added useEffect to load non-English locale on mount if stored

Benefits:
- Only active locale's JSON in initial bundle (English default)
- 80% reduction in locale data in initial bundle
- Other locale files load on demand (~50-100KB each)
- Removed unnecessary zod dependency from module
- Locale switching still works seamlessly
- Faster initial page load

Fixes #1143
2026-04-08 06:39:37 +05:30
..
LocaleContext.tsx perf: implement dynamic locale loading and remove unused zod import 2026-04-08 06:39:37 +05:30
platform-context.tsx chore: linting 2026-04-07 03:10:06 -07:00