Use zero for language id, not MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)
. Then FormatMessage
will pick the resource based on thread's language id, or it uses GetUserDefaultLangID
.
FormatMessage documentation:
DWORD WINAPI FormatMessage(
_In_ DWORD dwFlags,
_In_opt_ LPCVOID lpSource,
_In_ DWORD dwMessageId,
_In_ DWORD dwLanguageId,
_Out_ LPTSTR lpBuffer,
_In_ DWORD nSize,
_In_opt_ va_list *Arguments
);
dwLanguageId
:
If you pass a specific LANGID in this parameter, FormatMessage
will
return a message for that LANGID only. If the function cannot find a
message for that LANGID, it sets Last-Error to
ERROR_RESOURCE_LANG_NOT_FOUND
. If you pass in zero,
FormatMessage
looks for a message for LANGIDs in the following
order:
- Language neutral
- Thread LANGID, based on the thread's locale value
- User default LANGID, based on the user's default locale value
- System default LANGID, based on the system default locale value
- US English