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);".
The modified function looks like this:
function TApplication.IsRTLLang(const ALang: String): Boolean;
var
lng : String;
p : SizeInt;
function sep_pos : SizeInt; inline;
begin
Result := Pos('-', lng);
if Result = 0 then
Result := Pos('_', lng);
end;
begin
lng := LowerCase(ALang);
p := sep_pos;
if p > 0 then
SetLength(lng, 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;
Here is the patch.
diff --git a/lcl/include/application.inc b/lcl/include/application.inc
index 10abe008b0..4f3cfcfc9f 100644
--- a/lcl/include/application.inc
+++ b/lcl/include/application.inc
@@ -2464,9 +2464,9 @@ end;
function TApplication.IsRTLLang(const ALang: String): Boolean;
var
lng : String;
- p : word;
+ p : SizeInt;
- function sep_pos : word; inline;
+ function sep_pos : SizeInt; inline;
begin
Result := Pos('-', lng);
if Result = 0 then
@@ -2477,7 +2477,7 @@ begin
lng := LowerCase(ALang);
p := sep_pos;
if p > 0 then
- lng := copy(lng, 1, p-1);
+ SetLength(lng, p-1);
Result := (lng = 'ar') or // Arabic
(lng = 'he') or // Hebrew