Fallback to default sublanguage when loading resources

When a resource is not found in user's preferred language, first
try the primary language with SUBLANG set to default before
falling back to English.

See: https://github.com/OpenVPN/openvpn-gui/issues/216

Signed-off-by: Selva Nair <selva.nair@gmail.com>
pull/298/head
Selva Nair 2019-03-26 16:44:34 -04:00
parent 8a93336c97
commit 87c5e16723
1 changed files with 6 additions and 0 deletions

View File

@ -53,6 +53,12 @@ FindResourceLang(PTSTR resType, PTSTR resId, LANGID langId)
if (res)
return res;
/* try to find the resource in the default sublanguage */
LANGID defLangId = MAKELANGID(PRIMARYLANGID(langId), SUBLANG_DEFAULT);
res = FindResourceEx(o.hInstance, resType, resId, defLangId);
if (res)
return res;
/* try to find the resource in the default language */
res = FindResourceEx(o.hInstance, resType, resId, fallbackLangId);
if (res)