Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS.get_locale in Windows does not match sublang #37203

Closed
ippan opened this issue Mar 21, 2020 · 2 comments · Fixed by #40708
Closed

OS.get_locale in Windows does not match sublang #37203

ippan opened this issue Mar 21, 2020 · 2 comments · Fixed by #40708

Comments

@ippan
Copy link
Contributor

ippan commented Mar 21, 2020

Godot version:
3.2

OS/device including version:
Windows 10

Issue description:

OS.get_locale() does not return full locale
Ex: 'zh_TW' or 'zh_CN' will return 'zh' only

String OS_Windows::get_locale() const {

	const _WinLocale *wl = &_win_locales[0];

	LANGID langid = GetUserDefaultUILanguage();
	String neutral;
	int lang = langid & ((1 << 9) - 1);
	int sublang = langid & ~((1 << 9) - 1);

	while (wl->locale) {

		if (wl->main_lang == lang && wl->sublang == SUBLANG_NEUTRAL)
			neutral = wl->locale;

		if (lang == wl->main_lang && sublang == wl->sublang)
			return wl->locale;

		wl++;
	}

	if (neutral != "")
		return neutral;

	return "en";
}

may be change to int sublang = langid >> 10; will work.

@Calinou
Copy link
Member

Calinou commented Mar 21, 2020

This seems to be Windows-specific, as I get en_US on Linux (with my system configured in English). So this is indeed a bug.

@denormative
Copy link

Looks like this is OS-specific. I get "en-AU" on OSX (correct), "en_US" on linux (correct), and "en" on windows (only half correct).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment