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

Setting UI Language to "Auto Detection" will result in an English UI when the system language is Simplified Chinese #1304

Closed
gexgd0419 opened this issue Oct 18, 2021 · 1 comment
Labels
Status: Fixed in Next Build Fixed in the next Sandboxie version Type: Localization Localization/translation issues

Comments

@gexgd0419
Copy link
Contributor

Sandboxie-Plus will have an English UI in a Simplified Chinese system when Sandboxie's language setting is "Auto Detection".

After doing some research, I found that QLocale::system().name() returns "zh_CN" in my system, but the corresponding translation file is named sandman_zh-CN, so Sandboxie's language will fall back to English.

The translation files from the Qt installation have names like linguist_zh_CN.qm, suggesting that Qt separates the parts of locale names with underscores. Qt's documentation about QLocale::QLocale also tells you that.

Microsoft's documentation about locale names tells a different story, though. They separate those parts with hyphens, so "zh-CN" would be correct. However, passing "zh_CN" to the function LocaleNameToLCID still gives you the correct result.

Also here's some code from SandMan.cpp (line 2269):

QString LangAux = Lang; // Short version as fallback
LangAux.truncate(LangAux.lastIndexOf('_'));

Only when underscores are used to separate locale name parts will that fallback mechanism make sense.

@DavidXanatos DavidXanatos added the Status: Fixed in Next Build Fixed in the next Sandboxie version label Oct 18, 2021
@DavidXanatos
Copy link
Member

now it loks like this:

	QString Lang = theConf->GetString("Options/UiLanguage");
	if(Lang.isEmpty())
		Lang = QLocale::system().name();
	Lang.replace("_", "-");

	if (!Lang.isEmpty())
	{
		m_LanguageId = LocaleNameToLCID(Lang.toStdWString().c_str(), 0);

		QString LangAux = Lang; // Short version as fallback
		LangAux.truncate(LangAux.lastIndexOf('-'));

that should take care of teh issue

@isaak654 isaak654 added the Type: Localization Localization/translation issues label Jan 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Fixed in Next Build Fixed in the next Sandboxie version Type: Localization Localization/translation issues
Projects
None yet
Development

No branches or pull requests

3 participants