How to develop non English applications in VB6
Sometimes you need to develop an application in non English languages like Arabic, Persian etc. and it’s really boring when you see that your well coded program doesn’t work correctly in another computer. For example characters become strange. And maybe some properties like object.RightToLeft don’t work Right. So then if you be a professional coder, the first thing flashes in your mind is how about to write a module which give your program ability of supporting your desire language. Then what? For Example you can input Arabic words in a textbox or in a label or blablabla. Congratulations, what about directions? You can’t still change your Form’s property of RightToLeft to True & menus in Arabic will have a left to right direction. And it’s Boring again. I tell you what. Take it easy, there is no need to waste your time. Visual Basic basically supports Unicode languages like Arabic, Persian and so on; this feature is operational only when Microsoft Visual Basic is installed in a bi-directional 32-bit Microsoft Windows environment.
After installing Microsoft Windows XP you should install some additional languages.
Go to Control Panel>Regional and Language Options>Languages and select “Install Files for complex…” and press apply. Probably Windows ask you for Its CD.
Now you can easily write and read texts in Middle East languages. Let’s get back to where we were.
You are still unable to code in Arabic.
Go to This path: Control Panel>Regional and Language Options>Advanced.
Change language for Non Unicode programs to Farsi or Arabic.
Now try again. You can write Arabic alphabets in a Form’s Caption or in a Label.
Don’t be happy yet. How about target computer, if you compile your application and Run it in a platform that it’s Regional and Language Options have not been correctly modified, then you still see strange characters and everything goes wrong.
This time, the best thing you can do is writing some code that modifies Regional And Language Options automatically:
There are 3 ways to handle this problem:
1-Using Windows APIs.
2-Modifying some Registry keys under this :
Hkey_Local_Machine\System\Currentcontrolset\control\nls\
3-Asking widows to do this and it’s the best way.
First we create a file that contains local settings. You can find related article here.
Then we shell rundll32.Easy pizy. Ex for Persian:
‘Put a command button in a Form and name it Command1
Private Sub Command1_Click()
Open "c:\TempSetLang.txt" For Output As #1
Print #1, "[RegionalSettings]"
Print #1, "LanguageGroup=13"
Print #1, "SystemLocale=0429"
Print #1, "UserLocale=0429"
Close #1
Shell "Rundll32 shell32,Control_RunDLL intl.cpl,,/f:" & Chr(34) & _
“c:\TempSetLang.txt" & Chr(34)
Kill "c:\TempSetLang.txt"
MsgBox "Please restart the computer."
End Sub
Arabic :
…
Print #1, "SystemLocale=0401"
Print #1, "UserLocale=0401"
…
These numbers are Language IDs. As you see, Farsi language ID is 0429 Hex. And Arabic language ID is 0401 Hex. See complete list of language IDs here.
Good Luck
M.Barzegar
mabiran@gmail.com
هیچ نظری موجود نیست:
ارسال یک نظر