i18n: Less naïve approach at identifying language codes

This solves an issue I pointed out in PR #4705 where language codes
longer than 2 characters would get misidentified during the conversion
to Windows locale names.
This commit is contained in:
Iris Morelle 2020-01-19 01:27:13 -03:00
parent 48e6b821b0
commit df3b0222a8

View file

@ -216,8 +216,8 @@ static void wesnoth_setlocale(int category, const std::string& slocale,
#endif
#ifdef _WIN32
std::string win_locale(locale, 0, 2);
locale = posix_locale_to_win32(win_locale);
std::string lang_code{locale, 0, locale.find_first_of("_@.")};
locale = posix_locale_to_win32(lang_code);
#endif
char *res = nullptr;