AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1260
|
Posted: Thu Mar 01, 2018 7:28 am Post subject: Creating Multiple Language Options in Trainer |
|
|
Trainere, Put multiple language options for the user.
and that language, Button or
Move the selection with the image (Country Flag Image).
My advice; the selection window, you can create within the GroupBox.
This opens and closes the window with a single Button.
Place a GroupBox on the table and
name: get 'Language'. (Except the quotation marks)
Firstly;
let's code an interaction function that we have a choice of language.
Let's start with 4 language options.
Code: | function LanguageChange(sender)
if Lang == '0' then
English()
end
if Lang == '1' then
Portuguese()
end
if Lang == '2' then
Espanol()
end
if Lang == '3' then
Germany()
end
end |
then write the interaction codes and translations for the languages:
There are 4 languages in the example and 4 buttons to activate them.
Assign an OnClick language option for each button on the Tablodan.
CEButton1, onClick, English etc.
Code: | function English()
Lang = '0'
control_setCaption(UDF1_CEButton1, "English")
control_setCaption(UDF1_CEButton2, "English")
control_setCaption(UDF1_CEButton3, "English")
control_setCaption(UDF1_CEButton4, "English")
end
function Portuguese()
Lang = '1'
control_setCaption(UDF1_CEButton1, "Portuguese")
control_setCaption(UDF1_CEButton2, "Portuguese")
control_setCaption(UDF1_CEButton3, "Portuguese")
control_setCaption(UDF1_CEButton4, "Portuguese")
end
function Espanol()
Lang = '2'
control_setCaption(UDF1_CEButton1, "Espanol")
control_setCaption(UDF1_CEButton2, "Espanol")
control_setCaption(UDF1_CEButton3, "Espanol")
control_setCaption(UDF1_CEButton4, "Espanol")
end
function Germany()
Lang = '3'
control_setCaption(UDF1_CEButton1, "Germany")
control_setCaption(UDF1_CEButton2, "Germany")
control_setCaption(UDF1_CEButton3, "Germany")
control_setCaption(UDF1_CEButton4, "Germany")
end |
If you have a pop-up message
Let's do 2 buttons for 'INFO' or 'DESCRIPTION'.
Let's put 2 Buttons as an example:
showMessage and messageDialog..
Code: | function CEButton5Click(sender)
if Lang == '0' then
showMessage("Language English")
end
if Lang == '1' then
showMessage("Language Portuguese")
end
if Lang == '2' then
showMessage("Language Espanol")
end
if Lang == '3' then
showMessage("Language Germany")
end
end
function CEButton6Click(sender)
if Lang == '0' then
messageDialog( "Language English", 4, 0); -- Focus on the window you want; 'OK' or 'Yes' ; ", 4, 1); or ", 3, 1);
end
if Lang == '1' then
messageDialog( "Language Portuguese", 4, 1);
end
if Lang == '2' then
messageDialog( "Language Espanol", 4, 2);
end
if Lang == '3' then
messageDialog( "Language Germany", 4, 3);
end
end |
Now we have 1 GroupBox and 6 buttons in total,
We have 4 language options.
Add a Button or Image and open the GroupBox (Language) window.
Code: | function CEButton7Click(sender) -- or Image ;)
UDF1.Language.visible = true
UDF1.CEButton7.visible = false
LanguageChange(sender)
end |
After the language selection has been made, you want the selection window to close.
If so, add the following code to the language selection functions:
Code: | UDF1.Language.visible = false
UDF1.CEButton7.visible = true |
Code:
Code: | function English()
Lang = '0'
control_setCaption(UDF1_CEButton1, "English")
control_setCaption(UDF1_CEButton2, "English")
control_setCaption(UDF1_CEButton3, "English")
control_setCaption(UDF1_CEButton4, "English")
UDF1.Language.visible = false
UDF1.CEButton7.visible = true
end |
---------------------------->>>>
4 Total combination of language encoding:
Code: | function CEButton7Click(sender)
UDF1.Language1.visible = true
UDF1.CEButton7.visible = false
LanguageChange(sender)
end
function LanguageChange(sender)
if Lang == '0' then
English()
end
if Lang == '1' then
Portuguese()
end
if Lang == '2' then
Espanol()
end
if Lang == '3' then
Germany()
end
end
function English()
Lang = '0'
control_setCaption(UDF1_CEButton1, "English")
control_setCaption(UDF1_CEButton2, "English")
control_setCaption(UDF1_CEButton3, "English")
control_setCaption(UDF1_CEButton4, "English")
end
function Portuguese()
Lang = '1'
control_setCaption(UDF1_CEButton1, "Portuguese")
control_setCaption(UDF1_CEButton2, "Portuguese")
control_setCaption(UDF1_CEButton3, "Portuguese")
control_setCaption(UDF1_CEButton4, "Portuguese")
end
function Espanol()
Lang = '2'
control_setCaption(UDF1_CEButton1, "Espanol")
control_setCaption(UDF1_CEButton2, "Espanol")
control_setCaption(UDF1_CEButton3, "Espanol")
control_setCaption(UDF1_CEButton4, "Espanol")
end
function Germany()
Lang = '3'
control_setCaption(UDF1_CEButton1, "Germany")
control_setCaption(UDF1_CEButton2, "Germany")
control_setCaption(UDF1_CEButton3, "Germany")
control_setCaption(UDF1_CEButton4, "Germany")
end
function CEButton5Click(sender)
if Lang == '0' then
showMessage("Language English")
end
if Lang == '1' then
showMessage("Language Portuguese")
end
if Lang == '2' then
showMessage("Language Espanol")
end
if Lang == '3' then
showMessage("Language Germany")
end
end
function CEButton6Click(sender)
if Lang == '0' then
messageDialog( "Language English", 4, 0);
end
if Lang == '1' then
messageDialog( "Language Portuguese", 4, 1);
end
if Lang == '2' then
messageDialog( "Language Espanol", 4, 2);
end
if Lang == '3' then
messageDialog( "Language Germany", 4, 3);
end
end
UDF1.CEButton7.visible = true
UDF1.Language.visible = false
form_show(UDF1) |
Maybe this forum has been pre-processed!
But I did not find any end result.
I hope it will work.
Enjoy!
_________________
|
|