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
- Updated the development script to include a build step before launching the app.
- Refactored the registration of quick ask and autocomplete functionalities to be asynchronous, ensuring proper initialization.
- Introduced IPC channels for getting and setting keyboard shortcuts, allowing users to customize their experience.
- Enhanced the platform module to support better interaction with the Electron API for clipboard operations.
- Improved the user interface for managing keyboard shortcuts in the settings dialog, providing a more intuitive experience.
- toggle-group.tsx: Wrap contextValue in useMemo to prevent unnecessary re-renders
- animated-tabs.tsx: Hoist constants and memoize handlers with useCallback/useMemo
- LocaleContext.tsx: Wrap setLocale in useCallback and contextValue in useMemo
- plate-editor.tsx: Memoize SaveShortcutPlugin and contextProviderValue, use useRef for stable references