I have found a solution.
=====================
1) Select English as program interface language.
2) By using a code below export all components into a
ENG.SIL file
3) Select in program a Turkish language.
4) Export all components into a
TUR.SIL file
5) Open ENG.SIL in
TsiLang Files Editor
6) Merge
TUR.SIL to opened ENG.SIL file
7) Save a resulting ENG file. Now it contains both languages.
Code: Select all
procedure ExportFormText(frm: TForm; Lng: string; fn: string);
var L, L2, L3: TStrings; i, n, c: integer; S, nam, SCaptions, SHints, SItems, SCharSets, pfx1, pfx2: string;
PPL: PPropList; PL: TPropList;
begin
L:= TStringList.Create(); L2:= TStringList.Create();
Lng:= LeftStr(UpperCase(Lng), 3);
fn:= fn+ '_'+ Lng+ '.sil';
if Lng= 'ENG' then begin
pfx1:= '='; pfx2:= '~~';
end else begin // Turkish
pfx1:= '=~'; pfx2:= '~';
end;
SCaptions:= ''; SHints:= ''; SItems:= ''; SCharSets:= '';
with frm do begin
for i:= 0 to ComponentCount-1 do begin
nam:= Components[i].Name;
if IsPublishedProp((Components[i] as TObject), 'Font') then
// SCharSets:= SCharSets+ frm.Name+ '.'+ nam+ '=~TURKISH_CHARSET~'+ #10;
SCharSets:= SCharSets+ frm.Name+ '.'+ nam+ pfx1+ 'DEFAULT_CHARSET'+ pfx2+ #10;
if IsPublishedProp((Components[i] as TObject), 'Caption') then begin
S:= GetStrProp(Components[i], 'Caption');
if S<> '' then
SCaptions:= SCaptions+ frm.Name+ '.'+ nam+ pfx1+ S+ pfx2+ #10;
end;
if IsPublishedProp((Components[i] as TObject), 'Hint') then begin
S:= GetStrProp(Components[i], 'Hint');
if S<> '' then
SHints:= SHints+ frm.Name+ '.'+ nam+ pfx1+ S+ pfx2+ #10;
end;
if IsPublishedProp((Components[i] as TObject), 'Items') then begin // multilines
L2.Clear();
L2:= GetDynArrayProp(Components[i], 'Items');
if L2.Text<> '' then begin
n:= L2.Count;
for n:= 0 to L2.Count - 1 do
S:= S+ '"'+ L2[n]+ '",';
if S<> '' then begin
S:= LeftStr(S, Length(S)-1); // remove trailing comma
SItems:= SItems+ frm.Name+ '.'+ nam+ pfx1+ S+ pfx2+ #10;
end;
end;
end;
end;
end;
L.Add('[Captions]'); L.Add(SCaptions);
L.Add('');
L.Add('[CharSets]'); L.Add(SCharSets);
L.Add('');
L.Add('[Language names - for internal use only!]');
L.Add('Language_1=English');
L.Add('Language_2=Turkish');
L.Add('');
L.Add('[Multilines]'); L.Add(SItems);
if SHints<> '' then begin L.Add('[Hints]'); L.Add(SHints); end;
L.Add('[OPTIONS]');
L.Add('Delimiter=~');
L.Add('IsUTF8File=0');
L.Add('');
L.SaveToFile(fn);
L.Free(); L2.Free();
end;