How do I select which string table is used?

The last couple of weeks I've been learning myself VC++ 6.0.
So far I've written quite a nice little application, but it's all in
English (which seemed easier to start with) and being a
dutchman I'd like to be able to compile the whole thing with
Dutch texts too.

I've made 2 new configurations in Dutch (debug and release),
I've copied the resources that need translation and given
those the language property "Dutch (Netherlands)", and I
translated them. The two new configurations are set up to use
"Dutch..." too. And behold: still the English resources are being
used.

Allright, the dialogs, menu's, and accelerators can be switched
on or off by using a couple of #ifdefs, but not the string tables.
So: how do I make a multilingual program?
tafkaapAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chensuCommented:
Storing Strings (From the book "Developing International Software For Windows 95 and Windows NT")
http://msdn.microsoft.com/library/books/devintl/S24B3_a4.HTM
0
AlexVirochovskyCommented:
Hi, there are many ways to make this. I descibe my way.
1. All messages(and name of Dialogs) must be in rc File.   
2. In all palces in Progammes use LoadString for use
this message/text.
3. make rc Files for all languages.
4. From this rc Files make DLL(see Windows documentation
for make DLL from Resource File)
5. In Begin of  Programm LoadLibrary for Default Lang.(DLL)
6. make menu Laguages: English/France/Hebrew/...
7. If user change Lang,FreeLibrary (old Lang) and LoadLibrary
(new Lang)
8. In end of programm FreeLibrary
Alex
0
tafkaapAuthor Commented:
Your solution is too complicated (I think). The program doesn't have to be multilingual (several languages in 1 EXE), I'm just looking for a way to specify which string table is to be compiled. For dialogs, menu's etc. this can be done with defining a language code for each resource (e.g. _ENG or _DUTCH), but what about those strings?

0
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

chensuCommented:
Try

#ifdef _ENG
#include "res_eng.rc"
#else
#include "res_dutch.rc"
#endif
0
mikeblasCommented:
You should have separate string tables, each decorated with a LANGUAGE keyword that indicates which language the string tables represent.

Since each of those string tables is in a different language, it's allowable to have strings in each that share the same ID!

When you call LoadString(), Windows will try to find a match for the language you're currently running. That's called your thread's Locale, and is heavily documented.

If Windows can't find a match, it will load the string from the table you've marked as the default language. (See the /L option for the RC program.)

See the LANGLOAD.ZIP sample at my website, http://www.nwlink.com/~mikeblas/samples/ . The code there calls SetLocale() to switch the locale--but normally, you won't need to do that. The locale the user wants is set by the operating system before your app is started.

..B ekiM
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tafkaapAuthor Commented:
Although I don't understand all of it yet, your answer definitely put me back on the right track. I think the trouble is that my PC has some personality problems -- it's half English, half Dutch. Now I'll be able to tell it what it is...

Thanks for the example, too: those MSDN CD's are quite complete, but you never know if some explanation is meant for VB, VC, VP, VJ or whatever. Things were so much easier when developement tools where 10.000 times smaller... ;-)
0
tafkaapAuthor Commented:
A couple of hours later: I've tested it, and your example seems to work only with NT: the SetThreadLocale() function is not supported by W95. Yet it's given me a hint where to look next, so thanks anyway.

As for chensu's suggestion: I tried it, but VS won't allow more than 1 .RC file.

0
tafkaapAuthor Commented:
Is this question really worth only 5 points? I thought I said 50, and besides: it cost me 50. So Mike, if you only got five, I've give you 45 more.
0
mikeblasCommented:
You gave the question a value of 50 points. I answered, and you accepted. That gave me 50 points (times whatever factor for the letter grade you gave me).

The sample uses SetThreadLocale() just to show that you would load the other table if you had a different locale set.

In Windows 9x, I think the only way to set it is to tweak the dropdown in your "Regional Settings" page of the Control Panel.

..B ekiM
0
tafkaapAuthor Commented:
By now, I've solved the problem by defining _ENG and _NL for all other resources -- the Dutch string table can be selected by switching the English one to "Norwegian". Don't ask me why. :-) It's enough for the moment.

As for the 50 points: I suppose the question header just isn't accurate; but if you got the points I lost, all's well.

0
mikeblasCommented:
Oh, sorry: I meant to finish that paragraph. Now that the question has an accepted answer, anyone who wants to read the answer is charged five points for the privelege. The value is set at one-tenth of your original point award for your question.

Of course, those five points go nowhere--I don't get anything more. (And even if I did, it doesn't mean anything. I just have more points!)

..B ekiM
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.