mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-21 01:49:08 +02:00
Fix the error of Chinese system getting language information under Windows system
(cherry picked from commit c39a9ffad3
)
This commit is contained in:
parent
6b9d7f3bf1
commit
9f96c73881
@ -295,14 +295,20 @@ begin
|
|||||||
Lang := '';
|
Lang := '';
|
||||||
FallbackLang:='';
|
FallbackLang:='';
|
||||||
UserLCID := GetUserDefaultLCID;
|
UserLCID := GetUserDefaultLCID;
|
||||||
if GetLocaleInfo(UserLCID, LOCALE_SABBREVLANGNAME, @Buffer[1], 4)<>0 then
|
if GetLocaleInfo(UserLCID, LOCALE_SABBREVLANGNAME, @Buffer[1], 4)<>0 then begin
|
||||||
FallbackLang := lowercase(copy(Buffer,1,2));
|
FallbackLang := lowercase(copy(Buffer,1,2));
|
||||||
|
|
||||||
|
// Chinese abbreviation should be zh instead of ch
|
||||||
|
if (Copy(Buffer,1,3)='CHS') or (Copy(Buffer,1,3)='CHT') then FallbackLang:='zh';
|
||||||
|
end;
|
||||||
if GetLocaleInfo(UserLCID, LOCALE_SABBREVCTRYNAME, @Buffer[1], 4)<>0 then begin
|
if GetLocaleInfo(UserLCID, LOCALE_SABBREVCTRYNAME, @Buffer[1], 4)<>0 then begin
|
||||||
Country := copy(Buffer,1,2);
|
Country := copy(Buffer,1,2);
|
||||||
|
|
||||||
// some 2 letter codes are not the first two letters of the 3 letter code
|
// some 2 letter codes are not the first two letters of the 3 letter code
|
||||||
// there are probably more, but first let us see if there are translations
|
// there are probably more, but first let us see if there are translations
|
||||||
if (Buffer='PRT') then Country:='PT';
|
if (Buffer='PRT') then Country:='PT';
|
||||||
|
|
||||||
|
if (Copy(Buffer,1,3)='CHN') then Country:='CN';
|
||||||
|
|
||||||
Lang := FallbackLang+'_'+Country;
|
Lang := FallbackLang+'_'+Country;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user