Skip to content

添加国际化支持,集成i18next库,新增语言切换器组件,更新多个页面以支持多语言显示。更新package.json以包含相关依赖,并在应…#62

Merged
239573049 merged 1 commit into
mainfrom
feature/i18n
Apr 24, 2025

Conversation

@239573049

Copy link
Copy Markdown
Member

#57

This pull request introduces internationalization (i18n) support to the application by integrating i18next and refactoring UI components to dynamically adapt to language changes. Additionally, it includes structural improvements to the navigation and menu components using useMemo for performance optimization. Below are the key changes:

Internationalization (i18n) Integration:

  • Added i18next, react-i18next, and i18next-browser-languagedetector dependencies to the project (lobe/package.json).
  • Refactored Suspense fallback titles in lobe/src/App.tsx to use translations (e.g., t('pageTitle.loading.panel')) for dynamic language support.
  • Introduced useTranslation hook in various components (e.g., DesktopPage, LayoutPage, and Nav) to enable translated text for UI elements like buttons, menus, and headers. [1] [2] [3]

Navigation and Menu Refactoring:

  • Replaced hardcoded menu items in DesktopPage and Nav with dynamically generated items using useMemo to reflect language changes and improve performance. [1] [2] [3]
  • Added a LanguageSwitcher component to allow users to switch languages directly from the navigation bar. [1] [2]

Structural Enhancements:

  • Updated the DesktopPage and LayoutPage components to include dropdown menus and buttons with translated labels (e.g., "Enter System" and "Register"). [1] [2]
  • Introduced a useMemo-based approach for dropdown menu items in LayoutPage to ensure efficient re-rendering when the language changes.

Configuration and Guidelines:

  • Added a detailed configuration file (lobe/.cursor/rules/all.mdc) outlining design principles, task analysis, and quality criteria for UI design. This serves as a blueprint for consistent and professional UI development.

@239573049 239573049 merged commit 2c3d8fd into main Apr 24, 2025
@239573049 239573049 deleted the feature/i18n branch April 24, 2025 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant