MDUIDocsEnglish简体中文LightDarkSystem
Preset Colors
Custom Color
Extract Color from Wallpaper
Select a Wallpaper
Getting Started
Styles
Frameworks
Components
Functions
JavaScript Library dialog alert confirm prompt snackbar getTheme setTheme getColorFromImage setColorScheme removeColorScheme loadLocale setLocale getLocale throttle observeResize breakpoint
Libraries

setLocale

The setLocale function sets the current locale code. For more details, refer to Localization.

Usage

Import the function:

import { setLocale } from 'mdui/functions/setLocale.js';

Example:

setLocale('zh-cn').then(() => {
  // The locale switch is complete when the promise resolves
});

API

setLocale(LocaleCode): Promise<void>

This function accepts a locale code as an argument and returns a Promise. The locale switch is complete when the Promise resolves.

Refer to Supported Languages for a list of locale codes.

On this page