Re: Multilangual : how to?

From: Saga (antiSpam_at_somewhere.com)
Date: 04/12/04


Date: Mon, 12 Apr 2004 13:45:16 -0500

Ouch!

Then if I have 800 different messages, I have to define
a constant for each one?

What sort of overhead do resource files impose?

For example, I have an Italian and English application.
When I load each form, I have to check which language
it should load, load it and then get the messages into
the corresponding menu items, label, texts or whatever.
Perhaps I could load them when the program starts and
let the user stare at a splash screen while they all load, but
I am not sure this is the best way to do it.

I could also use a database and have a language table,
but I still need to determine, load and then assign the
messages. Would it be better/worse if I used a db instead?

How about maintenance? If I misspell a word, or need to
add a new message, do I need to recompile and distribute
the application? Using a database does avoid having to
recompile, but the matter of distribution is still an issue.

Another idea would be to wrap a collection of messages
around a class, then instantiate the right class for the selected
language. I have to guess that that would be faster than
going to a database, but it still leaves the problem of distribution,
not to mention that the class would have to be recompiled,
but if implemented as a DLL, at least it wouldn't involve
recompiling the entire app.

It seems that the issue, no matter what method is used,
(even the textfile method) is the DLA factor (determine,
load & assign). I guess it is just seeing which is better
or more convenient.

I know that resource files are the most applicable way
of going multilingual, but I keep wondering if they are the best.

Saga
"Vikram Lele" <viklele@yahoo.com> wrote in message
news:667002dd.0404120918.3d912b16@posting.google.com...
> Instead of keeping the messages in the textfile, you can keep them in
> the resource strings. You can add resource strings to your application
> using "Resource Editor" add-in available under Tools menu in VB.
>
> You can separate equivalent messages of different languages by fixed
> offsets. For example, if MSG1 in english is assigned resource ID 1000,
> the corresponding french message could be at resource ID 2000, and
> german message at resource ID 3000.
>
> In your application you should define constant for each messageID. For
> example
>
> Public Const RES_MSG1 = 0
> Public Const RES_MSG2 = 1
>
> etc...
>
> In your application, you can have a globally accessible variable which
> sets the base offset (lets call this RES_BASE), and when you need to
> read a message, you can use LoadResString call to load particular
> message.
>
> for example, when your application is starting up for english, you
> will set RES_BASE = 1000, and to load string corresponding to MSG1,
> you will use the call LoadResString(RES_BASE + RES_MSG1).
>
> When your application starts up for french, you will set
> RES_BASE=2000, but the rest of your application will not need to
> change atall.
>
> One of our products, VLMenuPlus, a drop-in VB menu enhancer provides
> multi-lingual menu support. We use a very similar scheme in there.
>
> HTH,
>
> Regards,
> Vikram
> ______________________________________
> Components For Your Software Solutions
> http://www.viklele.com
>
> "JohnK" <johnk@noreply.net> wrote in message
news:<407aa73a$0$125$3a628fcd@reader3.nntp.hccnet.nl>...
> > Hi,
> >
> > Is there a way to make an application multilangual? Until now I used a
> > textfile with messages like: "M123=<text>" and than a textfile for every
> > language. I presume there is another way to accomplish this, i.e. by
using a
> > dll. I don't want the user to see textfiles and I want to manage the
texts
> > in an easy way.
> > Now the app is reading the textfile completely when starting, but I only
> > want the messages (texts) when neede (=asked for). So I just want to
create
> > somethinmg like a language pack, but the app must remain the same all
the
> > time. (ofcourse after getting rid of the txt files)
> > I hope somebody out ther has a solution and please an example.
> >
> > Thanks
> > John
> >
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.645 / Virus Database: 413 - Release Date: 28-3-2004