Link to home
Start Free TrialLog in
Avatar of castelli
castelli

asked on

Multi-language support

Hi,
Whe are using Delphi 4.0, the customers wants his application in two languages ( Dutch and Frensh ). What is the best way to handle this. If you guys would have some examples or hints ... , I consider the maintenance part of it very important as the felxibility. We do not want to buy a product! And we want to give the user the possibility to swith between the two different languages at runtime
Avatar of ZifNab
ZifNab

Hi castelli,

 If you don't want to buy a product, then the maintanance part can be difficult.

There are several ways to do it :

 1. Making a .Ini file with all your translations
 2. Making a .res file with all your translations

Now, you can define Dutch=1 And French=2

Selecting a language will be something like

function ChangeLanguage(laguage:...);
begin
 {with ini file }

 Mybutton.Caption := load from dutch section of inifile
  or load the inifile {naam}.DUT
 
 {with res file}

 case language of
  Dutch : level := 1
  French : level := 2
 end;

 Mybutton.Caption := Load string 100+Level

etc....

as I said hard to maintain etc, offcourse you can make tools to make it easier,... but then why not buy one which is already proven?

Zif.
 

The way i use to do it is make a database with different tables for each language but with the right words on the right place

siabod, also possible but then you need the BDE. what if the program itself doesn't uses the BDE? Then you've the BDE only for your language support.

But, still good idea, you can use the QDB components for this, they don't need the BDE.
http://home.sprynet.com/sprynet/rrm/index.html

And the maintance is easier to make offcourse with such database-alike components.

Regards, Zif.
The way we do it is to convert literal strings into a function call

eg: ShowMessage('Fred was here') becomes
    ShowMessage(DVMStr(S_xxxxx_Fred_Was_here));

Where xxxxx is a number given to the string.

We then have a .RC file with the following entries

#DEFINE S_xxxxx_Fred_Was_here = xxxxx

and in the String table section

S_xxxxx_Fred_Was_here  = "Fred was here"

Strings that are part of components are taken care of by a set of derived components which have an additional property which is the string ID for the literal string. A couple of utilitie do clever things like extracting the strings fro mthe forms and setting the string resource IDs.

You can then translate the .RC file into the language of your choice.

We produce a DLL from the .RC file. The program loads the DLL and extract strings from it (thats what the DVMSTR function call does). If you have a french DLL your program turns into French - with a Dutch one its turns into Dutch! With a DLL you can even have the strings shown in the translated language in the forms at design time...

I hope this helps,

Raymond.

There are other components etc you can get from DSP et al but none of them were capable of doing what we needed (like support ~10,000 translatable strings over a dozen programs written in C, C++ and DELPHI)

Hi all,

Come on ! Take a look at TMultiLang:

http://www.preview.org/e/mldl.shtml

It´s about $ 49, and make things very much easier.

It doesn´t worth to spend even an hour to think about .RC, .RES, etc...

IHTH,
Itamar

Ooops !

They increased the price to $89 with source code.
ASKER CERTIFIED SOLUTION
Avatar of Thaddy
Thaddy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hey thaddy, that's interesting to know... again a plus-point for me to tell my boss I need D4. Can you also give some source? Zif.
Zif,

That's the neat part.....
...There is no source.... well, Just two directories and
two readily compilable resource dll's!
The delphi executable will automatically try to load the proper
resource dll by reading the system locale.