For anyone needing to do multi-language apps and don't want to write a lot of code checking what language the program is running, see below. I compiled a stringtable resource into my exe and this is how I used it for multi-language dialogs.
Instead of using the Runtime directives to check what language, I used a runtime variable to set the index for the messages into the stringtable and then load the messages from there depending upon the language. You could also create different stringtables for each language and then compiling them in by using the compile directives.
아래의 소스를 참고하면 되지 않을까요
Multi Language Applications
Eddie Shipman
For anyone needing to do multi-language apps and don't want to write a lot of code checking what language the program is running, see below. I compiled a stringtable resource into my exe and this is how I used it for multi-language dialogs.
Instead of using the Runtime directives to check what language, I used a runtime variable to set the index for the messages into the stringtable and then load the messages from there depending upon the language. You could also create different stringtables for each language and then compiling them in by using the compile directives.
Here is some example code, give it a try:
--------------------------------------------------------------------------------
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}
{ Here is the way the resource file for this project looks:
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?"
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; Optional}
ProgramLanguage : String;
begin
{ Here, I just set it to French }
ProgramLanguage := 'fra';
{ You can optionally get the language from Win.INI:}
{inifile := TInifile.Create('WIN.INI');
ProgramLanguage := inifile.ReadString('intl', 'sLanguage', 'enu');
inifile.Free;}
{ Forgive me if I leave out any languages, Tthese are th only ones
in my setup.inf for my copy of Windows.
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 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.
느티나무 wrote:
> 안녕하십니까?
> 델파이언 여러분..
> 아주 단순한데..
> date 함수를 쓰면 주로 06-2000 혹은 6월 2000년
> 이렇게 나오지요..
> 그런데 6월을 june 로 바꾸어서 나오게 하는법은
> 업나요?
> 한글 델파이라서 원래 없는지
> 아님 제가 몰라서 그런지
> (아무래도 후자 같아요..)
> 아시는문 알려주세요
>
> 간단히 다시 말하면
> 월을 영문으로 가져오고 싶어요..
>
> 그럼 여러 고수님들 한수 지도좀 바랍니다...