Loop through controls to change labels/buttons per language

A

Alex

Hi,

We're working on what will become a multi-language application, and I
wanted to see if this idea is feasable.

What we're thinking of doing is creating a table to contain all text
of the application and in multiple languages, for example:
Col1 - ID
Col2 - English
Col3 - French
Col4 - Spanish

When the application launches the user selects a language, and both
English and their chosen language will be loaded into a Dictionary in
memory. Then at the Form Load event for each form that loads, it'll
loop through all labels and buttons on the form, search the dictionary
for the given text, which is English, and replace it with the
alternative language text.

For dropdowns being populated by a look-up table, if these are saved
as a dictionary in of themselves, the look-up dictionary could then be
compared to the language dictionary and translated at Form Load as
well.

This is all in theory, but will this work? Also what caveats are we
looking at? I figure if the language dictionary is loaded when the
application launches there won't be too many DB calls.

Thanks --

Alex
 
K

kimiraikkonen

Hi,

We're working on what will become a multi-language application, and I
wanted to see if this idea is feasable.

What we're thinking of doing is creating a table to contain all text
of the application and in multiple languages, for example:
Col1 - ID
Col2 - English
Col3 - French
Col4 - Spanish

When the application launches the user selects a language, and both
English and their chosen language will be loaded into a Dictionary in
memory.  Then at the Form Load event for each form that loads, it'll
loop through all labels and buttons on the form, search the dictionary
for the given text, which is English, and replace it with the
alternative language text.

For dropdowns being populated by a look-up table, if these are saved
as a dictionary in of themselves, the look-up dictionary could then be
compared to the language dictionary and translated at Form Load as
well.

This is all in theory, but will this work?  Also what caveats are we
looking at?  I figure if the language dictionary is loaded when the
application launches there won't be too many DB calls.

Thanks --

Alex

Should work. But you may also consider XML which is quite popular. INI
files were being used also for multi-language applications IMHO.
 
T

Terry

You might want to look up "Localization" or "Globalization" in the help file
and check other places for those topics.
 
C

Cor Ligthert[MVP]

Terry,
You might want to look up "Localization" or "Globalization" in the help
file
and check other places for those topics.
--
You have ever tried that for this purpose? In my idea works the solution
from the OP much easier.
(And if he uses datasets written and read as XML then is is probably even
more simple)

Localization and Globalization don't give solutions for languages, only for
culture settings as decimals and the way dates are written.

Although the big problem stays how to get the correct equivalents for a
languages, that is not just looking in a dictionary, because a translation
can have a big other meaning then what you think as you are not familiar
with that language.

Beside that is it a hell of a job.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top