• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 183
  • Last Modified:

Mutli String Table Resource File with 2 languages.

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.
1 Solution

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

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.

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

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now