|
-
May 25th, 2011, 04:16 PM
#1
Thread Starter
Lively Member
(VB.NET) Program Translations - The lazy way.
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:
Code:
My.Settings.Lang = "English"
Label1.Text = "English"
After that, place code like Form1.Button1.Text = "Hello" etc.
With VOTish, do the same, only replace English with "VOTish" and "Hello" with ARR... 
The Form itself
We need to now go to Form1 and make a loading event (Double click the form). Then place this:
Code:
If My.Settings.Lang = "VOTish" Then
Again, place code like Button1.Text = "ARR..."
Don't place a code for English since it's already there 
Your done 
If you have MessageBoxes, status indicators, etc, use this:
Code:
If My.Settings.Lang = "VOTish" Then
...
ElseIf My.Setting.Lang = "English" Then
...
DO put in English since it's not there.
Last edited by VOT Productions; May 25th, 2011 at 04:16 PM.
Reason: Version 1.01 = Title correction
If my post was helpful to you, then use Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED  (from the pull down menu - Thread Tools)
Handy VB.NET Links: Language Translations
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|