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

fix: the UI language was incorrectly determined by "Region Format" #1298

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

ccyybn
Copy link
Contributor

@ccyybn ccyybn commented Jun 9, 2024

Before

image

After

image

@ccyybn
Copy link
Contributor Author

ccyybn commented Jun 9, 2024

实际改动是

  LANGID langId = GetUserDefaultUILanguage();
  if (langId == MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED) ||
      langId == MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SINGAPORE)) {
    langId = MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED);
  } else if (langId == MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL) ||
             langId == MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_HONGKONG) ||
             langId == MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_MACAU)) {
    langId = MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL);
  } else {
    langId = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US);
  }
  SetThreadUILanguage(langId);
  SetThreadLocale(langId);

diff 看起来多好像是换行符 CRLF 纠正成了 LF

@fxliang
Copy link
Contributor

fxliang commented Jun 9, 2024

有繁体香港这样的吗?会对应上SUBLANG_CHINESE_TRADITIONAL不?

@ccyybn
Copy link
Contributor Author

ccyybn commented Jun 9, 2024

有繁体香港这样的吗?会对应上SUBLANG_CHINESE_TRADITIONAL不?

现在应该能对应上了,补充上了香港、澳门、新加坡的情况,中文一共有五种

image

#1298 (comment)

@fxliang
Copy link
Contributor

fxliang commented Jun 9, 2024

langId = MAKELANGID(LANG_ENGLISH, SUBLANG_CHINESE_SIMPLIFIED);

是不是有typo?

@ccyybn
Copy link
Contributor Author

ccyybn commented Jun 9, 2024

langId = MAKELANGID(LANG_ENGLISH, SUBLANG_CHINESE_SIMPLIFIED);

是不是有typo?

看到了,等下改

int nCmdShow) {
UNREFERENCED_PARAMETER(hPrevInstance);

LANGID langId = GetUserDefaultUILanguage();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這個看起來比之前的 GetUserDefaultLCID() 更合適,應該可以解決 #1299

@ccyybn
Copy link
Contributor Author

ccyybn commented Jun 9, 2024

@fxliang 应该没问题了,测试了下分别 香港简体香港繁体 ,简繁也对应正常,似乎 香港简体 也是属于SUBLANG_CHINESE_SIMPLIFIED

image
image
image

@ccyybn
Copy link
Contributor Author

ccyybn commented Jun 9, 2024

image

@fxliang
Copy link
Contributor

fxliang commented Jun 9, 2024

挺好

下一些脑洞, 也许可以让用户自定义界面语言

1,weaselsetup 加参数,比如/LS /LT /LE 只设置语言,在HKCU下写状态字符串比如CHT CHS ENG
2,在现有基础判断前加读注册表的操作,如果有有效的设置就对应返回简繁英状态,否则照旧现有这个pr的逻辑
3,考虑获取langid的部分做到ultility里,复用代码,或改也方便点
4,看看有没有可能将fileformat (换行)维持原状

@ccyybn ccyybn force-pushed the fix_language branch 2 times, most recently from a4fc4fa to aa84abd Compare June 9, 2024 16:57
@ccyybn
Copy link
Contributor Author

ccyybn commented Jun 9, 2024

@fxliang

3, 改好了
4, 已维持原状,不过现在项目里的换行,文件编码各种都有

自定义这个功能我动力不太足耶,还是留给有需求的人改吧🤣

@fxliang
Copy link
Contributor

fxliang commented Jun 10, 2024

4, 已维持原状,不过现在项目里的换行,文件编码各种都有

这个后续集中一个commit 处理可能好点

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants