unit French1;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, IniFiles;
type
TForm1 = class(TForm)
Button1: TButton;
procedure FormActivate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
StringIndex: Integer;
implementation
{$R *.DFM}
{$R MULTLANG.RES}
{ Вот содержимое ресурсного файла для этого проекта:
1, "Attention"
2, "No Condition definition selected!"
3, "Always"
4, "Cannot delete the 'always' condition."
5, "Confirmation"
6, "Delete the condition?"
7, "Yes"
8, "No"
9, "Attention"
10, "Pas de condition Selectionnйe"
11, "Toulours"
12, "Ne peux effacer la condition 'Toujours'"
13, "Confirmation"
14, "Effacer cette condition?"
15, "&Oui"
16, "&Non"
}
procedure TForm1.FormActivate(Sender: TObject);
var
{inifile : TIniFile; Опционально}
ProgramLanguage: string;
begin
{ Устанавливаем французский язык }
ProgramLanguage := 'fra';
{ Дополнительно вы можете получить текущий язык из Win.INI:}
{inifile := TInifile.Create('WIN.INI');
ProgramLanguage := inifile.ReadString('intl', 'sLanguage', 'enu');
inifile.Free;}
{ Простите за то, что я привожу здесь несколько языков, указанные
ниже находились в файле setup.inf моей операционной системы.
dan = Danish
nld = Dutch
enu = English (American)
eng = English (International)
fin = Finnish
fra = French
frc = French Canadian
deu = German
isl = Icelandic
ita = Italian
nor = Norwegian
ptg = Portuguese
esp = Spanish
esn = Spanish (Modern)
sve = Swedish
}
if ProgramLanguage = 'enu' then
begin
StringIndex := 0;
end
else if ProgramLanguage = 'fra' then
begin
StringIndex := 8;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i, j, k: integer;
DialogForm: tform;
begin
Application.NormalizeTopMosts;
{No Condition definition selected!"}
DialogForm := CreateMessageDialog(LoadStr(StringIndex + 2), mtWarning,
[mbOK]);
{Attention}
DialogForm.caption := LoadStr(StringIndex + 1);
DialogForm.showmodal;
Application.RestoreTopMosts;
{Cannot delete the 'always' condition.}
DialogForm := CreateMessageDialog(LoadStr(StringIndex + 4), mtWarning,
[mbOK]);
{Always}
DialogForm.caption := LoadStr(StringIndex + 3);
DialogForm.showmodal;
Application.RestoreTopMosts;
{Delete the condition?}
DialogForm := CreateMessageDialog(LoadStr(StringIndex + 6), mtInformation,
[mbYes, mbNo]);
{confirmation}
DialogForm.caption := LoadStr(StringIndex + 5);
for j := 0 to DialogForm.controlCount - 1 do
begin
if DialogForm.controls[j] is tButton then
with tButton(DialogForm.controls[j]) do
begin
if caption = '&Yes' then
caption := LoadStr(StringIndex + 7);
if caption = '&No' then
caption := LoadStr(StringIndex + 8);
end;
end;
DialogForm.showmodal;
end;
end.
|