This is for advanced users. Beginners will struggle.
So I was doing a word processor once (VBForums needs to have a show-offs section), and was thinking, "Hmm, there is something missing... " and then I was "Program Translations! What about foreign users?"
It's quite easy to build, but I really don't recommend it for a program that uses text a lot because it can grow extremely unmanageable.
So, there are 3 parts to it.
TranslationForm = A form to change language. Changes language on the fly. There is a weird bug that makes not all forms change.
My.Settings.Lang = This is to know which language your using.
FormLoad code = Plays a big part. It changes text once it loads.
Finally, if your program uses MessageBoxes etc, we will be using If... Then blocks.
Let's get started!
My.Settings.Lang
Right click the project, go to Settings, and make a String setting called Lang.
The TranslationForm
(Have a form called Form1 with a Button1 ready)
Make a form called TranslationForm. Make two buttons. One of them will be English and one of them will be VOTish. VOTish? Well... anyway.
Make one label. The text property is English.
Double click English, place this code:
With VOTish, do the same, only replace English with "VOTish" and "Hello" with ARR...Code:My.Settings.Lang = "English" Label1.Text = "English" After that, place code like Form1.Button1.Text = "Hello" etc.
The Form itself
We need to now go to Form1 and make a loading event (Double click the form). Then place this:
Don't place a code for English since it's already thereCode:If My.Settings.Lang = "VOTish" Then Again, place code like Button1.Text = "ARR..."
Your done
If you have MessageBoxes, status indicators, etc, use this:
DO put in English since it's not there.Code:If My.Settings.Lang = "VOTish" Then ... ElseIf My.Setting.Lang = "English" Then ...



Reply With Quote