mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-11 01:18:16 +02:00
LazUtils: simplify LazGetShortLanguageID procedure logic
It actually wants to return FallbackLang, so just return it and do not make any assumptions about its length.
This commit is contained in:
parent
68228adb4e
commit
d05dd86b2c
@ -4075,11 +4075,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{
|
{
|
||||||
This routine will strip country information from the language ID
|
This routine will return current short language ID (without the country code).
|
||||||
making it more simple
|
|
||||||
|
|
||||||
Ideally the resulting ID from here should conform to ISO 639-1
|
Ideally the resulting ID from here should conform to ISO 639-1
|
||||||
or ISO 639-2, if the language has no code in ISO 639-1
|
or ISO 639-2, if the language has no code in ISO 639-1.
|
||||||
}
|
}
|
||||||
procedure LazGetShortLanguageID(var Lang: String);
|
procedure LazGetShortLanguageID(var Lang: String);
|
||||||
var
|
var
|
||||||
@ -4087,9 +4086,7 @@ var
|
|||||||
begin
|
begin
|
||||||
FallbackLang:='';
|
FallbackLang:='';
|
||||||
LazGetLanguageIDs(Lang, FallbackLang);
|
LazGetLanguageIDs(Lang, FallbackLang);
|
||||||
|
Lang:=FallbackLang;
|
||||||
// Simply making sure its length is at most 2 should be enough for most languages
|
|
||||||
if Length(Lang) > 2 then Lang := Lang[1] + Lang[2];
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user