Multi-language
TechUI features a built-in lightweight, self-developed global multi-language solution. It adopts an on-demand asynchronous loading strategy, enabling application-level internationalization support without the need to integrate third-party libraries.
Detailed Documentation This page serves only as a feature overview. For complete initialization configuration, semantic structure, and language switching implementation, please refer to the Complete Internationalization System Documentation.
Core Features
- Out of the Box: Integrated into the global service
$tService, requiring no cumbersome configuration. - On-Demand Loading: Automatically detects the environment and loads only the currently required language pack (e.g.,
cn,hk,en), reducing resource size. - Reactive: All components and states automatically update after switching languages.
Basic Usage
In any component, you can retrieve translated text by injecting the global i18n function.
import { inject } from 'vue';
// 1. Inject i18n function
const { i18n } = inject('$global');
// 2. Get static text
const text = i18n('universal.confirm'); // Output: "Confirm"
// 3. Get dynamic text with parameters
const msg = i18n('panicAlert.device.content', {
deviceA: 'PC',
deviceB: 'Mobile'
});Support Scope & Outlook
Current Support: Currently, the official built-in support includes three standard locales:
- cn: Simplified Chinese
- hk: Traditional Chinese (Hong Kong)
- en: English
Limitations & Outlook: The current version does not yet support custom language extensions or business text overrides. This means you can currently only use TechUI's preset language packs. We plan to open registration interfaces in future versions, allowing developers to mount custom language packs or reuse the i18n pipeline to manage business text.