Page loading

Share your opinion
What do you think about gambaslinux.fr?
 
Interesting
It miss some informations
Excellent website
Results
WIDGETS GAMBAS
GAMBAS 3 SOFTWARES
TUTORIALS
Library
_gb3.pngUse File - Translate application

APPLICATION TRANSLATION (not use linux locales)


translation.png
Here I have done a method to translate a gambas application without using your locale.
You have to create 3 files with your translation. Every line is a translation of characters(textbutton, label etc...)
In this example, i created 3 files : fr, en, and es (i have removed txt extention, we are on linux ;)
Here the french file with comments

Exemple de traduction : Title of window
Comment aimez-vous le chocolat? : A question in a label
Salé : Text on button 1
Sucré : Text on button 2
Bravo à vous, c'est très bien : Answer 1
Non ce n'est pas bon : Answer 2
Quitter : text of quit button

Now, you can put this code in your application :

Private mylanguage As String = "fr"
Private answer1 As String
Private answer2 As String

Public Sub _new()
End

Public Sub Form_Open()
Me.Center
updatetranslation()
End

Public Sub bquit_Click()
Me.Close
End

Public Sub bfrench_Click()
mylanguage = "fr"
updatetranslation()
End

Public Sub benglish_Click()
mylanguage = "en"
updatetranslation()
End

Public Sub bspain_Click()
mylanguage = "es"

updatetranslation()
End

Private Sub updatetranslation()
Dim myfile As File
Label1.Text = Null
myfile = Open Application.Path & "/" & mylanguage For Read 
Line Input #myfile, Me.Text
Line Input #myfile, lquestion.Text
Line Input #myfile, b1.Text
Line Input #myfile, b2.Text
Line Input #myfile, answer1
Line Input #myfile, answer2
Line Input #myfile, bquit.Text
Close #myfile
End

Public Sub b1_Click()
Label1.Text = answer1
End

Public Sub b2_Click()
Label1.Text = answer2
End


Now you have 3 languages for your application.
Regards
 ;)

Creation date : 03/06/2014 @ 00:49
Last update : 03/06/2014 @ 00:49
Category : Use File
Page read 3601 times


Print the article Print the article


react.gifReactions to this article

Nobody gave a comment yet.
Be the first one to do it!


QUICK MENU
SEARCH




LANGUAGE
COMPONENTS
Other
LANGUAGE
Where, who?
VISITS

   visitors

   visitors online

ARCHIVES GAMBAS 1/2
^ Top ^