Solved

Load different language strings

Posted on 2003-10-24
6
384 Views
Last Modified: 2013-11-20
Hi All,
I have a aplication that is using 2 language strings (english and norwegian) what i want to do is ... when i run  the application, i.e at the runtime , I want to load the strings from the both language string tables.... i have some tags stord in this string tables and at run time the user enters a tag ( it can be in english or in norwegian) and regardless of the users language setting i want to load both the strins .... i tried to use this .Loadstring() but it will load according to the local language. how can i load strings of both of these languages

Thankx in advance
Rijal
0
Comment
Question by:Rijal
6 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 250 total points
ID: 9613361
Create a DLL that will store all the resource.
ie. In an empty DLL MFC project add all the resource for a particular Language.
In the similar way add DLLs for each language.

Each DLL will have resource.h. This file should be same for each DLL, only the corresponding STRINGS will change.

And in your main project, include this resource.h. For loading different languages, load the different DLLs and get this strings by setting this DLL as the Resource, Now the code....



HINSTANCE hInstance = LoadLibrary("EnglishDLL.dll");
AfxSetResourceHandle(hInstance);

//LOAD THE STRING USING *LoadString*, so you will get english resource


hInstance = LoadLibrary("NorwegianDLL.dll");
AfxSetResourceHandle(hInstance);

LoadString(----)

Now you will get the norwegian string...

Good Luck :)
0
 
LVL 48

Assisted Solution

by:AlexFM
AlexFM earned 250 total points
ID: 9613685
If you are working with VC++ 7 or later, you can use the LoadString function which has Language ID parameter. In VC++ 6 such function may be implemented using FindResource API.
0
 
LVL 1

Expert Comment

by:abdo81
ID: 9619385
Create INI file for each language you have.
Use GetPrivateProfileString to load the strings from the INI file.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now