Browse Source

fall back to English resource if string is missing

pull/1/head
Heiko Hund 13 years ago
parent
commit
56654663f5
  1. 9
      localization.c

9
localization.c

@ -106,12 +106,12 @@ LoadStringLang(UINT stringId, LANGID langId, PTSTR buffer, int bufferSize, va_li
/* find resource block for string */ /* find resource block for string */
HRSRC res = FindResourceLang(RT_STRING, resBlockId, langId); HRSRC res = FindResourceLang(RT_STRING, resBlockId, langId);
if (res == NULL) if (res == NULL)
return 0; goto err;
/* get pointer to first entry in resource block */ /* get pointer to first entry in resource block */
entry = (PWCH) LoadResource(o.hInstance, res); entry = (PWCH) LoadResource(o.hInstance, res);
if (entry == NULL) if (entry == NULL)
return 0; goto err;
/* search for string in block */ /* search for string in block */
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
@ -140,6 +140,11 @@ LoadStringLang(UINT stringId, LANGID langId, PTSTR buffer, int bufferSize, va_li
return _tcslen(buffer); return _tcslen(buffer);
} }
err:
/* not found, try again with the default language */
if (langId != fallbackLangId)
return LoadStringLang(stringId, fallbackLangId, buffer, bufferSize, args);
return 0; return 0;
} }

Loading…
Cancel
Save