Skip to content

Internationalization

Note

The internationalization (i18n) language switching functionality is implemented based on Element Plus's i18n.

Default Language Configuration

This project supports multiple languages, with English as the default language.

The default language is set through the defaultLanguageLocale constant. To change the default language, simply modify the value of this constant:

ts
export const defaultLanguageLocale = 'en'

Extending Supported Languages

The project currently supports the following languages, as detailed in src/locales/index.ts:

ts
export const localesMapping = [
  {
    localeCode: 'zh-hans',
    localeName: '简体中文',
    localeLang: {...}
  },
  {
    localeCode: 'en',
    localeName: 'English',
    localeLang: {...}
  }
]

To add support for a new language:

  • Add a new language object to the localesMapping array

  • Create the corresponding language file in the src/locales/lang/ directory (e.g., de.ts for German)

    ./lang
    ├── en.ts
    └── zh-hans.ts
  • Import and merge the Element Plus language pack with your custom language files to ensure both UI components and custom content are localized