Refactor and optimize templates and code structure

- Deleted outdated templates for epics, product brief, and requirements PRD.
- Introduced lazy loading for locale messages in i18n module to enhance performance.
- Updated main application bootstrap to parallelize CSRF token fetching and locale loading.
- Implemented code splitting for router configuration to optimize bundle size and loading times.
- Added WebSocket connection limits and rate limiting to improve server performance and prevent abuse.
- Enhanced input validation with compiled regex patterns for better performance and maintainability.
This commit is contained in:
catlog22
2026-03-02 15:57:55 +08:00
parent ce2927b28d
commit 73cc2ef3fa
79 changed files with 306 additions and 14108 deletions

View File

@@ -68,9 +68,21 @@ const messages: Record<Locale, Record<string, string>> = {
zh: {},
};
/**
* Load messages for a specific locale only (lazy loading)
* This is the optimized init method that loads only the active locale
*/
export async function loadMessagesForLocale(locale: Locale): Promise<Record<string, string>> {
const localeMessages = await loadMessages(locale);
messages[locale] = localeMessages;
updateIntl(locale);
return localeMessages;
}
/**
* Initialize translation messages for all locales
* Call this during app initialization
* NOTE: Use loadMessagesForLocale() for faster single-locale init
*/
export async function initMessages(): Promise<void> {
// Load messages for both locales in parallel