473,322 Members | 1,241 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Multilingual Application

Hello! I am looking for a good way to make an application multilingual.
Danish/English for now (but I don't want to preclude more than two languages
eventually) Every dialog will have an option for changing language (except
simple dialog boxes)

Here is what I am envisioning - I want to make sure I am on the right track:

There is a global language object which handles giving out strings, has
functions for setting/retrieving the current language and giving an array of
all available languages (in string format).

All the strings are contained in a giant hashtable and have string
references. Strings are accessed like this (this is an example only):

STable["SUREDELETE?"]

If the current language is english this could return the string "Are you
sure that you want to delete this file?"

I'm planning to embed all the strings into the program (a giant function
which contains all the strings and populates the string table on first
use) - so they could be easily edited, and avoid having to access strings
from an outside file. This is a small application, so I am not too woried
about the size of the function.

Every form would have an "updatecomponents" function which would set the
text of all affected components to their respective language.

I still need a way to trigger this updatecomponents if the language is
changed in another window, particularly if I will be making use of modeless
dialogs keeping language a global setting. Maybe windows message? (Better
ideas?)

Does this system for handling changing languages sound good?

Oh BTW - I am using Visual Studio 2003, if that makes any difference.

--
LTP

:)
May 22 '07 #1
7 3128
I can't help thinking that you are inventing the wheel... and there is
more than just the words... display formats (such as comma/period
separators, etc) can all change. Most of this is already covered in
culture-sensitive resource files... I can't remember exactly which
features were added/changed in 2.0, but in VS2005 it is quite easy to
link captions etc directly to resource entries using Localizable and
Language.

Note that some Control's will respond unkindly to the UI locale
changing underneath them... perhaps consider setting the UI-thread's
locale at the start of the app; do they genuinely change language so
often that you can't have this take effect on the next app restart
(which you could initiate)? Hooking into some global mechanism (such
as event) seems like a good way to start a memory "leak" (quoted as
not a true leak... just that the global event will still have
visibility of all the subscribers unless they *always* remember to
unsubscribe).

Marc
May 22 '07 #2
This might be an idea for you - looks really nice and easy to use to me...

http://www.jollans.com/multilang_dot...for_dotnet.htm

Held og lykke,
Johnny J.


"Luc The Perverse" <sl***********************@cc.usu.eduwrote in message
news:26************@loki.cmears.id.au...
Hello! I am looking for a good way to make an application multilingual.
Danish/English for now (but I don't want to preclude more than two
languages eventually) Every dialog will have an option for changing
language (except simple dialog boxes)

Here is what I am envisioning - I want to make sure I am on the right
track:

There is a global language object which handles giving out strings, has
functions for setting/retrieving the current language and giving an array
of all available languages (in string format).

All the strings are contained in a giant hashtable and have string
references. Strings are accessed like this (this is an example only):

STable["SUREDELETE?"]

If the current language is english this could return the string "Are you
sure that you want to delete this file?"

I'm planning to embed all the strings into the program (a giant function
which contains all the strings and populates the string table on first
use) - so they could be easily edited, and avoid having to access strings
from an outside file. This is a small application, so I am not too woried
about the size of the function.

Every form would have an "updatecomponents" function which would set the
text of all affected components to their respective language.

I still need a way to trigger this updatecomponents if the language is
changed in another window, particularly if I will be making use of
modeless dialogs keeping language a global setting. Maybe windows
message? (Better ideas?)

Does this system for handling changing languages sound good?

Oh BTW - I am using Visual Studio 2003, if that makes any difference.

--
LTP

:)

May 22 '07 #3
It is much easier to use resouce files, which will act a lot like a state
machine (much like your hashtable). And, this is already built into .NET, so
you do not have to write the mechanism.

You have two choices in the default implementation.

1. Global resources - single file for all resources. This is great for items
taht appear on multiple pages, like button captions, etc.
2. Page resources - best for localizing a single page

If you go to MSDN, however, Michele Bustamante has written a wonderful
article on using external resource DLLs and databases for your localization
efforts.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

************************************************
Think outside the box!
************************************************
"Luc The Perverse" <sl***********************@cc.usu.eduwrote in message
news:26************@loki.cmears.id.au...
Hello! I am looking for a good way to make an application multilingual.
Danish/English for now (but I don't want to preclude more than two
languages eventually) Every dialog will have an option for changing
language (except simple dialog boxes)

Here is what I am envisioning - I want to make sure I am on the right
track:

There is a global language object which handles giving out strings, has
functions for setting/retrieving the current language and giving an array
of all available languages (in string format).

All the strings are contained in a giant hashtable and have string
references. Strings are accessed like this (this is an example only):

STable["SUREDELETE?"]

If the current language is english this could return the string "Are you
sure that you want to delete this file?"

I'm planning to embed all the strings into the program (a giant function
which contains all the strings and populates the string table on first
use) - so they could be easily edited, and avoid having to access strings
from an outside file. This is a small application, so I am not too woried
about the size of the function.

Every form would have an "updatecomponents" function which would set the
text of all affected components to their respective language.

I still need a way to trigger this updatecomponents if the language is
changed in another window, particularly if I will be making use of
modeless dialogs keeping language a global setting. Maybe windows
message? (Better ideas?)

Does this system for handling changing languages sound good?

Oh BTW - I am using Visual Studio 2003, if that makes any difference.

--
LTP

:)

May 22 '07 #4
That looks like a nice tool. :-)

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

************************************************
Think outside the box!
************************************************
"Johnny Jörgensen" <jo**@altcom.sewrote in message
news:ew**************@TK2MSFTNGP03.phx.gbl...
This might be an idea for you - looks really nice and easy to use to me...

http://www.jollans.com/multilang_dot...for_dotnet.htm

Held og lykke,
Johnny J.


"Luc The Perverse" <sl***********************@cc.usu.eduwrote in message
news:26************@loki.cmears.id.au...
>Hello! I am looking for a good way to make an application multilingual.
Danish/English for now (but I don't want to preclude more than two
languages eventually) Every dialog will have an option for changing
language (except simple dialog boxes)

Here is what I am envisioning - I want to make sure I am on the right
track:

There is a global language object which handles giving out strings, has
functions for setting/retrieving the current language and giving an array
of all available languages (in string format).

All the strings are contained in a giant hashtable and have string
references. Strings are accessed like this (this is an example only):

STable["SUREDELETE?"]

If the current language is english this could return the string "Are you
sure that you want to delete this file?"

I'm planning to embed all the strings into the program (a giant function
which contains all the strings and populates the string table on first
use) - so they could be easily edited, and avoid having to access strings
from an outside file. This is a small application, so I am not too
woried about the size of the function.

Every form would have an "updatecomponents" function which would set the
text of all affected components to their respective language.

I still need a way to trigger this updatecomponents if the language is
changed in another window, particularly if I will be making use of
modeless dialogs keeping language a global setting. Maybe windows
message? (Better ideas?)

Does this system for handling changing languages sound good?

Oh BTW - I am using Visual Studio 2003, if that makes any difference.

--
LTP

:)


May 22 '07 #5
"Johnny Jörgensen" <jo**@altcom.sewrote in message
news:ew**************@TK2MSFTNGP03.phx.gbl...
This might be an idea for you - looks really nice and easy to use to me...

http://www.jollans.com/multilang_dot...for_dotnet.htm

Held og lykke,
Johnny J.
Wow!

I have never seen anything like this.

Too bad it is not freeware ;)

--
LTP

:)
May 23 '07 #6
"Marc Gravell" <ma**********@gmail.comwrote in message
news:e2**************@TK2MSFTNGP02.phx.gbl...
>I can't help thinking that you are inventing the wheel...
That's what I wanted to hear! That means I'm doing it wrong and it will be
even less work :)
and there is more than just the words... display formats (such as
comma/period separators, etc) can all change. Most of this is already
covered in culture-sensitive resource files... I can't remember exactly
which features were added/changed in 2.0, but in VS2005 it is quite easy
to link captions etc directly to resource entries using Localizable and
Language.

Note that some Control's will respond unkindly to the UI locale changing
underneath them... perhaps consider setting the UI-thread's locale at the
start of the app; do they genuinely change language so often that you
can't have this take effect on the next app restart (which you could
initiate)? Hooking into some global mechanism (such as event) seems like a
good way to start a memory "leak" (quoted as not a true leak... just that
the global event will still have visibility of all the subscribers unless
they *always* remember to unsubscribe).
All of this might be a bigger concern if I were making a much larger
application. (Understandable - I didn't give a lot of details.)

Mostly we will be working with static label boxes . . some file stuff, but
no file names will need translation.

But I thank you for the good advice - I never would have thought of
restarting the application to change language - or even having the language
run in one language its entire execution.

The application will always have a login screen at the beginning - maybe I
could have one hard coded multilingual dialog (the login) and then it could
just be set the entire time.

If the language weren't going to change then I could just get all the text
set at dialog initialization - the only text I'd ever need to fetch would be
some messageboxes.

Suddenly things are looking up!

--
LTP

:)
May 23 '07 #7
"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote in
message news:eo**************@TK2MSFTNGP05.phx.gbl...
It is much easier to use resouce files, which will act a lot like a state
machine (much like your hashtable). And, this is already built into .NET,
so you do not have to write the mechanism.

You have two choices in the default implementation.

1. Global resources - single file for all resources. This is great for
items taht appear on multiple pages, like button captions, etc.
2. Page resources - best for localizing a single page

If you go to MSDN, however, Michele Bustamante has written a wonderful
article on using external resource DLLs and databases for your
localization efforts.
Thank you :)

--
LTP

:)
May 23 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ed | last post by:
I want to create a multilingual website in ASP. Is the Dictionary object created with the application-level scope the way to go?
0
by: Corobori | last post by:
I am developping a multilingual application. I would like to find an installer integrated with .NET allowing me to develop a multilingual interface as well as including the NET Framework in those...
0
by: Charles | last post by:
Hi, I'm looking for best practices for building a multilingual database. It is for an multilingual application that will use a persistence layer. I would like to know what are the different...
7
by: J?rg Keller | last post by:
Hi all I have to localize an Access 2002 application: The application using several form, tables etc. is currently only in English. Now the frontend has to be bilingual, so the user can choose...
3
by: charliewest | last post by:
Building Multilingual Portal I have been assigned a new project to build a multilingual portal using ASP.NET and the expected Microsoft technologies including C#, ADO.NET and SQL Server 2000. ...
2
by: amitmnagarwal | last post by:
I am using the following code to access the resourc file. Dim sAssembly As sAssembly = .GetExecutingAssembly() Dim rm As New ResourceManager("MultiLingual.Info", sAssembly) ''Case...
0
by: balaki | last post by:
Hi All, I have a Multilingual VB6 application, which rightnow supports French language. When I debug the code, it works in French, by changing the regional settings - locale to French(France)....
2
by: raju | last post by:
Hai all, I am working on the multilingual application, in asp.net. In that we are displaying contents in some other language (user selected language). In that page, we are having some textbox...
1
by: Abhijit D. Babar | last post by:
I have to create a multilingual application in Visual c++ .net 2008. I have a Windows form application and i want to run this on multilingual support. So how can i do this. Which change i have...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.