LCL, LCLTranslator: When finding language ID, don't always explicitly analyze LANG variable, let LazGetLanguageIDs procedure do its job instead.

LazGetLanguageIDs will look at LANG on Linux/Unix just fine (and in correct order, see issue #37937), and on Windows this is non-standard location and thus using it can potentially lead to unexpected results.
This commit is contained in:
Maxim Ganetsky 2023-06-06 02:57:21 +03:00
parent 917c994925
commit d8f4c3990b

View File

@ -114,16 +114,8 @@ begin
end;
end;
//User can decide to override locale with LANG variable.
if Lang = '' then
Lang := GetEnvironmentVariableUTF8('LANG');
if Lang = '' then
LazGetLanguageIDs(Lang, T);
//Trim encoding from Lang if it presents. E. g. Lang can be `ru_RU.utf8`.
if Lang <> '' then
LazTrimLanguageID(Lang);
end;
function FindLocaleFileName(LCExt, LangID, Dir, LocaleFileName: string; out FoundLang: string): string;