Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Internationalization - multi-lingual

Status
Not open for further replies.

StellaIndigo

IS-IT--Management
Sep 19, 2002
118
GB
Hi

I am writing an app this will be used in several countries and I want to provide the user with messages etc. in their native language.

I was looking at having an xml file with all my text for each supported language then when the app launches I load the text for the appriopriate language. i.e.

<language>EN</language>
<object>MainWindow</object>
<text>My message in English</text>
<language>DE</language>
<object>MainWindow</object>
<text>Meine... etc.

Anyone done this before or got any experience with this kind of internationalization? Good idea or not?



Regards
Stella

There are 10 types of people in the world. Those that understand binary and those that don't.
 
Stella,

the Teach Yourself Delphi 4 in 21 Days talks about exactly this problem, i.e. providing messages in different languages, and it recommends that you use resource dlls.
It gives the following snippets of example code:
Code:
var
  DLLName: string;
begin
  case Language of
    laFrench: DLLName := 'french.dll';
    laGerman: DLLName := 'german.dll';
    laSpanish: DLLName := 'spanish.dll';
    laEnglish: DLLName := 'english.dll';
  end;
  DLLInstance := LoadLibrary(PChar(DLLName));
end;
and
Code:
LoadString(DLLInstance, MY_MESSAGE, Buff, SizeOf(Buff));

Where MY_MESSAGE is the id number of the resource to load. To create a resource dll, create a new dll and add the line
Code:
{$R RESOURC.RES}
Obviously these bits of code don't comprise a full listing of the code you would need, but I don't want to go into creating resources and loading dlls, because you might well know more about it than me. Hope this helps in some way!

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top