mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2026-11-24 13:04:29 +08:00
1.2 KiB
1.2 KiB
Internationalization entry point
Purpose
- This entry point owns internationalization for the project.
- It includes the wrapped useI18n API, locale-resource entry points, and helpers.
- Extend and use locale configuration according to the established format.
lang resource entry points
The project includes English and Chinese resources. Add languages using the same format. Each resource file identifies a locale; JSON resources are imported automatically.
Format
Locale resources use JSON to work with @intlify/unplugin-vue-i18n/vite.
Adding a locale
- Add the resource file, named after the locale.
- Configure its entry point using
combineI18nMessagesfor automatic merging. - Keep locale names globally unique.
Helpers
getAppLocalMessagesreturns all application locales. It depends on LOCAL_OPTIONS keys, which must correspond one-to-one withsrc/locales/lang/xxx.tsentries.naiveLocalesreturns matchingnaive-uilocale resources.getAppDefaultLanguagereturns the application's current default locale.
useI18n
The application wraps i18n. Use that wrapper rather than the library's unwrapped useI18n.
- It supports
tandvalueoutside setup. - Its behavior otherwise follows the official API.