Mutli String Table Resource File with 2 languages.

Posted on 2003-03-26
Medium Priority
Last Modified: 2010-08-05
i am developing an application for use of 2 languages. One is English and other is spanish. I populated everything in the resource file. All the time when the app opens, it takes the default English. But when i change in input locales from language settings in control panel to Spanish, the Spanish language is populated.
How can i make the language change manually?? That i can switch between languages manually from my application.
Please help.
Question by:SriG
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

Expert Comment

ID: 8214322

Put a label and a comboBox in a form and Run the Program

Index the code from the language you want from the comboBox

Code Resource:

101- Esta é uma frase em Português.
102- This is a phrase in English.
103- C'est une expression dans le Français.
104- Dieses ist eine Phrase auf German.
105- Ciò è una frase in Italiano.
106- Esto es una frase en Español.  


Option Explicit

Dim A
Private Sub Combo1_Click()
   A = 101 + Combo1.ListIndex
   Label1 = LoadResString(A)
End Sub

Private Sub Form_Load()
   Me.Top = (Screen.Height - Me.Height) / 2
   Me.Left = (Screen.Width - Me.Width) / 2
   Combo1.AddItem "Portugês"
   Combo1.AddItem "Inglês"
   Combo1.AddItem "Francês"
   Combo1.AddItem "Alemão"
   Combo1.AddItem "Italiano"
   Combo1.AddItem "Espanhol"
   Combo1.Text = "Português"
End Sub


Accepted Solution

stretch71 earned 420 total points
ID: 8214880
The only locale information you can change at runtime is the thread locale, and you need to be running Windows 2000 or Windows XP to do it.

You use the API call setthreadlocale to change the locale to the one you want and then you will have to refresh your controls/labels/etc so that they can reload their captions and so forth.

The better alternative is to use language specific resource dll's since you can determine what dll to load when ever you want and you don't have to provide all the languages in one dll (so smaller deployment).  There is a bit more work invovled in setting it up but once it's done it's pretty easy.


Expert Comment

ID: 8221984
stretch71 has the right idea, setthreadlocale also works for winnt platforms.  I used that for a Korean/English flip.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month13 days, 17 hours left to enroll

801 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