setLocale 函式用來設定目前的在地化語言代碼。詳見 在地化。
setLocale
按需引入函式:
import { setLocale } from 'mdui/functions/setLocale.js';
使用範例:
setLocale('zh-cn').then(() => { // promise 被 resolve 時,語言切換完成 });
setLocale(LocaleCode): Promise<void>
函式的參數為語言代碼,回傳值為 Promise,在 Promise resolve 時,語言切換完成。
語言代碼清單參見 支援的語言。