From 87c5e16723491629ef4844fb9e87e625abfc13d7 Mon Sep 17 00:00:00 2001 From: Selva Nair Date: Tue, 26 Mar 2019 16:44:34 -0400 Subject: [PATCH] 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 --- localization.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/localization.c b/localization.c index 29085a1..bf4dc64 100644 --- a/localization.c +++ b/localization.c @@ -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)