Solved

Load different language strings

Posted on 2003-10-24
6
392 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.

762 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