Multilingual User Interface

Uses your system voice; voice and rate in settings.

Snapshot

≈ 4 min read

Names in other languages

No names in other languages are held for this entry yet.

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

The Multilingual User Interface (MUI) is a dynamic localization framework used in Microsoft Windows, Windows Phone, and compatible programs; it allows language files to be modular and separate from application logic. It is designed to simplify the development and deployment of localized software. MUI has a number of advantages compared to traditional static localization. Software that uses MUI can do the following: * Store language resources in dedicated files instead of hardcoding them into program binaries, making it possible to update localizations and code dynamically without recompilation. * Automatically select a language from Windows' language preferences, instead of asking the user at runtime. * Use the Win32 API to load resources from MUI language files. The MUI framework, API, and its localization files (called Language Packs, or LPs) were introduced in Windows 2000; these were significantly expanded on with Windows Vista, which allowed developers to use MUI in their software. Language Interface Packs (LIPs) were added in Windows 7 to supplement Language Packs. LIPs were replaced by Local Experience Packs (LXPs) in Windows 10 build 1809.

The Multilingual User Interface (MUI) is a dynamic localization framework used in Microsoft Windows, Windows Phone, and compatible programs; it allows language files to be modular and separate from application logic. It is designed to simplify the development and deployment of localized software. MUI has a number of advantages compared to traditional static localization. Software that uses MUI can do the following: Store language resources in dedicated files instead of hardcoding them into program binaries, making it possible to update localizations and code dynamically without recompilation. Automatically select a language from Windows' language preferences, instead of asking the user at runtime. Use the Win32 API to load resources from MUI language files. The MUI framework, API, and its localization files (called Language Packs, or LPs) were introduced in Windows 2000; these were significantly expanded on with Windows Vista, which allowed developers to use MUI in their software. Language Interface Packs (LIPs) were added in Windows 7 to supplement Language Packs. LIPs were replaced by Local Experience Packs (LXPs) in Windows 10 build 1809. LPCWSTR languageIdSpec = L"en-US\0"; ULONG langCount = 1; if (!SetThreadPreferredUILanguages(MUI_LANGUAGE_NAME, languageIdSpec, &langCount)) MessageBoxW(NULL, L"Unable to set thread preferred UI language.", NULL, MB_ICONERROR); wchar_t *resourceCharArray; int resourceLength = LoadStringW(moduleHandle, resourceId, (LPWSTR)&resourceCharArray, 0); if (!resourceLength) { MessageBoxW(NULL, L"Unable to find resource.", NULL, MB_ICONERROR); return -1; } wchar_t *text = (LPWSTR)malloc((resourceLength + 1) * sizeof(wchar_t)); wcsncpy(text, resourceCharArray, resourceLength); text[resourceLength] = L'\0'; // null terminate This retrieves the address of the resource text character buffer which is not guaranteed to be null terminated. Then, this copies the characters to a new buffer and appends a null terminator. Another option is to have LoadString copy the string to a passed buffer, but that requires using a fixed-length buffer which has downsides like usually allocating more than needed or truncation if too short. Oddly, MS documentation for LoadString does not mention its interaction with MUI—use of language preference. FormatMessage is also MUI-enabled. Its function reference page describes its interaction with the user's language preference when parameter dwLanguageId is passed as 0. But FormatMessage reads from a message table, not a string table and as Raymond Chen says, "nobody actually uses message tables".

Text derived from https://en.wikipedia.org/w/index.php?oldid=1357329743 under CC BY-SA 4.0; modifications have been made.

Sources cited in this revision

Extracted from the cited revision's reference blocks; absent citations are not invented.