Improvement of TApplication.IsRTLLang
by 'lagprogramming'.
lcl/include/application.inc has
function TApplication.IsRTLLang(const ALang: String): Boolean;
var
lng : String;
p : word;
function sep_pos : word; inline;
begin
Result := Pos('-', lng);
if Result = 0 then
Result := Pos('_', lng);
end;
begin
lng := LowerCase(ALang);
p := sep_pos;
if p > 0 then
lng := copy(lng, 1, p-1);
Result := (lng = 'ar') or // Arabic
(lng = 'he') or // Hebrew
(lng = 'yi') or // Yiddish
// The languages bellow usually use arabic as the language name
(lng = 'dv') or
(lng = 'ps') or
(lng = 'az') or
(lng = 'fa') or
(lng = 'ks') or
(lng = 'ku') or
(lng = 'pa') or
(lng = 'sd') or
(lng = 'tk') or
(lng = 'ug') or
(lng = 'ur') { or
Not sure about the following languages ...
They do not have 2 letters ISO standard are they in use ?
(lng = 'jpr') or
(lng = 'syr') or
(lng = 'nqo') or
(lng = 'jrb')
}
;
end;
In order to match the result of the "Pos" function and the parameter of the "copy" function, variable "p" and nested function "sep_pos" have been changed from word to sizeint. After that, the line "lng := copy(lng, 1, p-1);" has been replaced with "SetLength(lng, p-1);".
Edited by Alexey Torgashin