| 
			
				|  | Cheat Engine The Official Site of Cheat Engine
 
 
 |  
 
	
		| View previous topic :: View next topic |  
		| Author | Message |  
		| AylinCE Grandmaster Cheater Supreme
 
  Reputation: 37 
 Joined: 16 Feb 2017
 Posts: 1528
 
 
 | 
			
				|  Posted: Tue Feb 27, 2018 8:58 pm    Post subject: [Fixed]Help for the language option box! |   |  
				| 
 |  
				| Help for the language option box! I tried coding with ComboBax and GroupBox.
 Button functions are working properly.
 But the message boxes are not trading.
 And I did a CT uses Coding examples.
 I would be glad if the Masters observations. Thanks in advance.
 
 
 
  	  | Code: |  	  | function CEButton5Click(sender) UDF1.Language.visible = true
 UDF1.CEButton5.visible = false
 LanguageChange(sender)
 end
 
 
 function LanguageChange(sender)
 LangClient = component_findComponentByName(UDF1,'Language')
 Lang = getProperty(LangClient,'ItemIndex')
 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()
 LangClient = component_findComponentByName(UDF1,'Language')
 Lang = getProperty(LangClient,'ItemIndex')
 control_setCaption(UDF1_CEButton1, "English")
 control_setCaption(UDF1_CEButton2, "English")
 control_setCaption(UDF1_CEButton3, "English")
 control_setCaption(UDF1_CEButton4, "English")
 end
 
 function Portuguese()
 LangClient = component_findComponentByName(UDF1,'Language')
 Lang = getProperty(LangClient,'ItemIndex')
 control_setCaption(UDF1_CEButton1, "Portuguese")
 control_setCaption(UDF1_CEButton2, "Portuguese")
 control_setCaption(UDF1_CEButton3, "Portuguese")
 control_setCaption(UDF1_CEButton4, "Portuguese")
 end
 
 function Espanol()
 LangClient = component_findComponentByName(UDF1,'Language')
 Lang = getProperty(LangClient,'ItemIndex')
 control_setCaption(UDF1_CEButton1, "Espanol")
 control_setCaption(UDF1_CEButton2, "Espanol")
 control_setCaption(UDF1_CEButton3, "Espanol")
 control_setCaption(UDF1_CEButton4, "Espanol")
 end
 
 function Germany()
 LangClient = component_findComponentByName(UDF1,'Language')
 Lang = getProperty(LangClient,'ItemIndex')
 control_setCaption(UDF1_CEButton1, "Germany")
 control_setCaption(UDF1_CEButton2, "Germany")
 control_setCaption(UDF1_CEButton3, "Germany")
 control_setCaption(UDF1_CEButton4, "Germany")
 end
 
 function CEButton6Click(sender)
 LangClient = component_findComponentByName(UDF1,'Language')
 Lang = getProperty(LangClient,'ItemIndex')
 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 CEButton7Click(sender)
 LangClient = component_findComponentByName(UDF1,'Language')
 Lang = getProperty(LangClient,'ItemIndex')
 if Lang == '0' then
 messageDialog( "Language English")
 end
 if Lang == '1' then
 messageDialog( "Language Portuguese")
 end
 if Lang == '2' then
 messageDialog( "Language Espanol")
 end
 if Lang == '3' then
 messageDialog( "Language Germany")
 end
 end
 
 UDF1.CEButton5.visible = true
 UDF1.Language.visible = false
 form_show(UDF1)
 | 
 
 https://www.dropbox.com/s/tb0877yzlgnks6i/Language4.CT?dl=0
 _________________
 
 
 Last edited by AylinCE on Wed Feb 28, 2018 7:03 am; edited 1 time in total
 |  |  
		| Back to top |  |  
		|  |  
		| Corroder Grandmaster Cheater Supreme
 
  Reputation: 75 
 Joined: 10 Apr 2015
 Posts: 1668
 
 
 |  |  
		| Back to top |  |  
		|  |  
		| AylinCE Grandmaster Cheater Supreme
 
  Reputation: 37 
 Joined: 16 Feb 2017
 Posts: 1528
 
 
 | 
			
				|  Posted: Wed Feb 28, 2018 6:57 am    Post subject: |   |  
				| 
 |  
				| GroupBox Name: Language1 onChange: ChangeBounds
 and Change Code:
 
 
  	  | Code: |  	  | function LanguageChange(sender) LangClient = component_findComponentByName(UDF1,'Language1')
 Lang = getProperty(LangClient,'ItemIndex')
 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
 | 
 
 CEButton1 or CEImage ..
 onClick: English
 and Code:
 
 
  	  | Code: |  	  | function English() LangClient = component_findComponentByName(UDF1,'Language')
 Lang = getProperty(LangClient,'ItemIndex')
 Lang = '0' --- The important code that ensures correcting! Interacting with sub commands
 control_setCaption(UDF1_CEButton1, "English")
 control_setCaption(UDF1_CEButton2, "English")
 control_setCaption(UDF1_CEButton3, "English")
 control_setCaption(UDF1_CEButton4, "English")
 end
 --end
 function Portuguese()
 LangClient = component_findComponentByName(UDF1,'Language')
 Lang = getProperty(LangClient,'ItemIndex')
 Lang = '1'
 control_setCaption(UDF1_CEButton1, "Portuguese")
 control_setCaption(UDF1_CEButton2, "Portuguese")
 control_setCaption(UDF1_CEButton3, "Portuguese")
 control_setCaption(UDF1_CEButton4, "Portuguese")
 end
 | 
 
 and the entire message category works with the selected language.
   and Code:
 
 
  	  | Code: |  	  | function CEButton6Click(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
 -- Test and use the dialogue approval parameters as you wish. ", 3, 1); or ", 4, 0); etc...
 function CEButton7Click(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
 | 
 
 Now you can add language options to the Trainer
   _________________
 
 
 Last edited by AylinCE on Fri Jan 27, 2023 9:00 am; edited 1 time in total
 |  |  
		| Back to top |  |  
		|  |  
		| Corroder Grandmaster Cheater Supreme
 
  Reputation: 75 
 Joined: 10 Apr 2015
 Posts: 1668
 
 
 | 
			
				|  Posted: Thu Mar 01, 2018 8:28 am    Post subject: |   |  
				| 
 |  
				|  	  | Corroder wrote: |  	  | There are no comboBox has created. 
 
  	  | Code: |  	  | LangClient = component_findComponentByName(UDF1,'Language') Lang = getProperty(LangClient,'ItemIndex')
 
 | 
 | 
 
 I mean, there are no CEComboBox has created on this CT file :
 
 https://www.dropbox.com/s/tb0877yzlgnks6i/Language4.CT?dl=0
 
 mean while you said :
 
 
  	  | Quote: |  	  | Help for the language option box! I tried coding with ComboBax and GroupBox.
 
 | 
 
 But, leave it, You've done with your work event seem like 'Sam FV2 Trainer' for languages option. Well done...
 _________________
 
 Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
 |  |  
		| Back to top |  |  
		|  |  
		| AylinCE Grandmaster Cheater Supreme
 
  Reputation: 37 
 Joined: 16 Feb 2017
 Posts: 1528
 
 
 | 
			
				|  Posted: Thu Mar 01, 2018 10:42 am    Post subject: |   |  
				| 
 |  
				|  	  | Corroder wrote: |  	  | 
 But, leave it, You've done with your work event seem like 'Sam FV2 Trainer' for languages option. Well done...
 | 
 
 Thanks Master @Corroder
 
 The code I found with the research, Originally:
 Language options showed in the ComboBox.
 I scanned the original code and CT,
 I did not find any code listing the ComboBox.
 So I opened a forum for help.
 But I saw that; can be done in different ways.
 
 I shared this on the forum. everyone should benefit.
   
 EDIT: Your help always took me one step forward. Thank you.
 I will never forget the masters.
 
 https://www.youtube.com/watch?v=ZC8RhizylLM
 _________________
 
 |  |  
		| Back to top |  |  
		|  |  
		| packrat How do I cheat?
 
 ![]() Reputation: 0 
 Joined: 11 Jun 2013
 Posts: 9
 
 
 | 
			
				|  Posted: Thu Jan 26, 2023 3:34 pm    Post subject: |   |  
				| 
 |  
				| How can i do this with ComboBox? |  |  
		| Back to top |  |  
		|  |  
		| AylinCE Grandmaster Cheater Supreme
 
  Reputation: 37 
 Joined: 16 Feb 2017
 Posts: 1528
 
 
 | 
			
				|  Posted: Fri Jan 27, 2023 3:54 am    Post subject: |   |  
				| 
 |  
				|  	  | packrat wrote: |  	  | How can i do this with ComboBox? | 
 
 I hope there are no errors.  I can't check on the phone.
 You should try.
 
 
  	  | Code: |  	  | if f1 then f1.Destroy() f1=nil end f1 = createForm()
 
 -- edit trainer name ..
 local CBox1 = createComboBox(f1) --yourTrainerName.CECombobox1
 l1 = createLabel(f1)
 l1.top=100 l1.left=5 l1.caption=" . . ."
 l2 = createLabel(f1)
 l2.top=50 l2.left=5 l2.caption=". . ."
 l3 = createLabel(f1)
 l3.top=150 l3.left=5 l3.caption=" . . ."
 -- edit Cbox list.
 local tblLanguages={"English","Germany","Portuguese"}
 
 CBox1.clear()
 CBox1.Items.Add("Select Language")
 for i,k in pairs(tblLanguages) do
 CBox1.Items.Add(k)
 end
 
 local Lang = "1"
 CBox1.ItemIndex=Lang
 -------------
 function message()
 msg = ""
 if Lang=="1" then msg="This is a message!" end        ----
 if Lang=="2" then msg="Dies ist eine Nachricht!" end
 if Lang=="3" then msg="Esta é uma mensagem!" end
 return msg
 end
 function English()
 l1.caption = "This is the hack description."
 l2.caption = "Will you activate this?"
 l3.caption = "Don't be shy.. Nothing will happen."
 end
 
 function Germany()
 l1.caption = "Dies ist die Hack-Beschreibung."
 l2.caption = "Wirst du das aktivieren?"
 l3.caption = "Seien Sie nicht schüchtern. Es wird nichts passieren."
 end
 
 function Portuguese()
 l1.caption = "Esta é a descrição do hack."
 l2.caption = "Você vai ativar isso?"
 l3.caption = "Não seja tímido. Nada vai acontecer."
 end
 -------------
 
 function languages()
 local item = CBox1.ItemIndex
 if (item==1) then  Lang="1" English() end
 if (item==2) then   Lang="2" Germany() end
 if (item==3) then  Lang="3" Portuguese() end
 -- print("Index: " .. CBox1.ItemIndex)
 showMessage(message())
 end
 
 --Lang = "3"
 languages()
 
 CBox1.OnChange=languages
 | 
 _________________
 
 |  |  
		| Back to top |  |  
		|  |  
		| packrat How do I cheat?
 
 ![]() Reputation: 0 
 Joined: 11 Jun 2013
 Posts: 9
 
 
 | 
			
				|  Posted: Fri Jan 27, 2023 2:11 pm    Post subject: |   |  
				| 
 |  
				| Perfect. Its works good thanks alot for the help |  |  
		| Back to top |  |  
		|  |  
		| Corroder Grandmaster Cheater Supreme
 
  Reputation: 75 
 Joined: 10 Apr 2015
 Posts: 1668
 
 
 | 
			
				|  Posted: Fri Jan 27, 2023 10:08 pm    Post subject: |   |  
				| 
 |  
				| Just play around. If you are plan to make multi language apps, especially using Lua then consider to use PO file and compile the PO file to MO file (binary file), such as CE used for CE app which translation to some language, (Google for what is PO, POT and MO file). Or use RES file, RC file or INI file to save languages translation constructor. 
 You can make a PO file using a text editor save as a PO file and then edit or compile using POEdit as an example tool (https://poedit.net/).
 
 How the PO file look like?. This is an example (for Turkish) :
 
 
  	  | Code: |  	  | msgid "My Form" msgstr "Benim Formum"
 
 msgid "English"
 msgstr "Ingilizce"
 
 msgid "Chinese"
 msgstr "Çince"
 
 msgid "Turkish"
 msgstr "Türk"
 
 msgid "Open Lua Table"
 msgstr "LuaTables'ı aç"
 
 msgid "Close"
 msgstr "kapalı"
 
 msgid "Active language is Turkish"
 msgstr "Aktif dil Çince"
 | 
 
 After compiled the PO file to MO file then you can use it like this, example :
 
 
  	  | Code: |  	  | function load_mo_file(mo_file) local fd,err=io.open(mo_file,"rb")
 if not fd then return nil,err end
 local mo_data=fd:read("*all")
 fd:close()
 local byte=string.byte
 local sub=string.sub
 local peek_long --localize
 local magic=sub(mo_data,1,4)
 if magic=="\222\018\004\149" then
 peek_long=function(offs)
 local a,b,c,d=byte(mo_data,offs+1,offs+4)
 return ((d*256+c)*256+b)*256+a
 end
 elseif magic=="\149\004\018\222" then
 peek_long=function(offs)
 local a,b,c,d=byte(mo_data,offs+1,offs+4)
 return ((a*256+b)*256+c)*256+d
 end
 else
 return nil,"no valid mo-file"
 end
 
 local V=peek_long(4)
 if V~=0 then
 return nul,"unsupported version"
 end
 
 local N,O,T=peek_long(8),peek_long(12),peek_long(16)
 local hash={}
 for nstr=1,N do
 local ol,oo=peek_long(O),peek_long(O+4) O=O+8
 local tl,to=peek_long(T),peek_long(T+4) T=T+8
 hash[sub(mo_data,oo+1,oo+ol)]=sub(mo_data,to+1,to+tl)
 end
 return hash
 end
 
 ---- ======================================================================----
 ---- Unit Test
 ---- ======================================================================----
 
 --- #1 Create GUI
 if f1 then f1.Destroy() end
 f1 = createForm()
 f1.Height = 150
 f1.Caption = "My Form"
 f1.Position = poScreenCenter
 
 CBox1 = createComboBox(f1)
 CBox1.setPosition(10,10)
 CBox1.Width = 145
 
 Btn1 = createButton(f1)
 Btn1.setPosition(10, CBox1.Top + CBox1.Height + 10)
 Btn1.setSize(145,28)
 Btn1.Caption = "Open Lua Table"
 
 Btn2 = createButton(f1)
 Btn2.setPosition(Btn1.Left + Btn1.Width + 10, CBox1.Top + CBox1.Height + 10)
 Btn2.setSize(145,28)
 Btn2.Caption = "Close"
 
 Lbl1 = createLabel(f1)
 Lbl1.setPosition(Btn1.Left, Btn1.Top + Btn1.Height + 20)
 Lbl1.Font.Size = 16
 Lbl1.Caption = "Active language is English"
 
 --- #2 Add items to combobox (languages)
 local tblLanguages={"English","Chinese","Turkish"}
 CBox1.clear()
 for i,k in pairs(tblLanguages) do
 CBox1.Items.Add(k)
 end
 CBox1.ItemIndex = 0
 
 --- #3 Identify the language choose by user and load from mo file stream ans set components caption
 --- _cons = {"My Form", "English", "Chinese", "Turkish", "Open Lua Table", "Close", "Active language is English"}
 
 _path = "F:\\MyDownload\\"
 
 function lngchoose()
 idx = CBox1.ItemIndex
 if idx == 0 then
 mo_data = assert(load_mo_file(_path.."english.mo"))
 Lbl1.Caption = mo_data["Active language is English"]
 elseif idx == 1 then
 mo_data = assert(load_mo_file(_path.."chinese.mo"))
 Lbl1.Caption = mo_data["Active language is Chinese"]
 elseif idx == 2 then
 mo_data = assert(load_mo_file(_path.."turkish.mo"))
 Lbl1.Caption = mo_data["Active language is Turkish"]
 else
 return nil
 end
 f1.Caption = mo_data["My Form"]
 CBox1.clear()
 CBox1.Items.Add(mo_data["English"])
 CBox1.Items.Add(mo_data["Chinese"])
 CBox1.Items.Add(mo_data["Turkish"])
 CBox1.ItemIndex = 0
 Btn1.Caption = mo_data["Open Lua Table"]
 Btn2.Caption = mo_data["Close"]
 end
 
 
 --- #4 Show the form
 f1.Show()
 CBox1.OnChange = lngchoose
 
 | 
 
 Note :
 1. Change the path to where you placed the MO file
 2. You can try load the MO file from table file, MAYBE using read stream file
 3. You can try to change components caption own by the main form using components count / name / tag, etc by generating for loop
 4. Or create a table to store items from MO file
 5. Down some MO file used on the example from here :
 https://mega.nz/file/6hUGAZYJ#QwaLa9ylOkRHjy8b4tFcPzD_kkutFy8Le2C3K6FNzjo
 
 Good luck
 
 
 
 
	
		
	 
		| Description: |  |  
		| Filesize: | 52.06 KB |  
		| Viewed: | 5188 Time(s) |  
		| 
  
 
 |  
 _________________
 
 Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
 |  |  
		| Back to top |  |  
		|  |  
		| AylinCE Grandmaster Cheater Supreme
 
  Reputation: 37 
 Joined: 16 Feb 2017
 Posts: 1528
 
 
 | 
			
				|  Posted: Sat Jan 28, 2023 1:02 am    Post subject: |   |  
				| 
 |  
				| Thanks again @Corroder for contributing. It's nice to refer to CE's current language pack code.
 But it requires generating many files and packaging them separately.
 
 The code below is a little clearer and can be listed and read in a single file.
 
 Name all your translations as a table and package it as "LanguagesFile.lua" (Or whatever you name it.), click CE>>Lua Table>>Add File and add it to CE and use it.
 
 Here is an example;
 
 LanguagesFile.lua codes:
 
 
  	  | Code: |  	  | language = {"English","Chinese","Turkish"} 
 form = {"My Form","我的表格","Benim Formum"}
 
 button1 = {"Open Lua Table","打开 LuaTable","LuaTables'ı aç"}
 
 button2 = {"Close", "关闭","Kapat"}
 
 label1 = {"Active language is: ","活動語言:","Aktif dil: "}
 
 msg1 = {"You have opened the Lua Table!","您已經打開了 Lua 表!","Lua Tablosunu açtınız!"}
 
 msg2 = {"Goodbye!","再見!","Hoşcakalın!"}
 | 
 
 Form:
 
 
  	  | Code: |  	  | ---- load languages file if lang1 then lang1.Destroy() lang1=nil end
 lang1 = findTableFile('LanguagesFile.lua').stream; --your file name?
 lang1 = load(readStringLocal(lang1.memory,lang1.size))()
 
 ---- ======================================================================----
 ---- Unit Test
 ---- ======================================================================----
 
 if f1 then f1.Destroy() end
 f1 = createForm()
 f1.Height = 150
 f1.Caption = "My Form"
 f1.Position = poScreenCenter
 
 CBox1 = createComboBox(f1)
 CBox1.setPosition(10,10)
 CBox1.Width = 145
 
 Btn1 = createButton(f1)
 Btn1.setPosition(10, CBox1.Top + CBox1.Height + 10)
 Btn1.setSize(145,28)
 Btn1.Caption = "Open Lua Table"
 
 Btn2 = createButton(f1)
 Btn2.setPosition(Btn1.Left + Btn1.Width + 10, CBox1.Top + CBox1.Height + 10)
 Btn2.setSize(145,28)
 Btn2.Caption = "Close"
 
 Lbl1 = createLabel(f1)
 Lbl1.setPosition(Btn1.Left, Btn1.Top + Btn1.Height + 20)
 Lbl1.Font.Size = 16
 Lbl1.Caption = "Active language is: English"
 
 --======================================================
 local Lang = 1
 
 CBox1.clear()
 for i,k in pairs(language) do
 CBox1.Items.Add(k)
 end
 CBox1.ItemIndex = 0
 
 function changeText(idx,lang)
 f1.Caption = form[idx]
 Btn1.Caption = button1[idx]
 Btn2.Caption = button2[idx]
 Lbl1.Caption = label1[idx]..lang
 end
 
 function lngchoose()
 idx = CBox1.ItemIndex
 if idx then
 Lang = tonumber(idx) + 1
 changeText(Lang,CBox1.Text)
 end
 end
 
 Btn1.OnClick=function() showMessage(msg1[Lang]) end
 Btn2.OnClick=function() showMessage(msg2[Lang]) end
 
 f1.Show()
 CBox1.OnChange = lngchoose
 | 
 _________________
 
 |  |  
		| Back to top |  |  
		|  |  
		| Corroder Grandmaster Cheater Supreme
 
  Reputation: 75 
 Joined: 10 Apr 2015
 Posts: 1668
 
 
 | 
			
				|  Posted: Sat Jan 28, 2023 7:02 am    Post subject: |   |  
				| 
 |  
				|  	  | AylinCE wrote: |  	  | ...But it requires generating many files and packaging them separately. | 
 
 As I said on my last post, it say "If you plan to make a multi language app", that mean an application not just a CE Trainer.
 Many apps, have their version depending by the user language. It's packed by a "language pack". OS Windows have their language pack placed on a folder when you installing Windows to your machine.
 Event CE have the translation version to many language and DB put the translation PO file too on CE Website.
 go to: https://www.cheatengine.org/download.php
 and see the "Translation" part.
 
 
 The translation file PO, MO, POT etc, also using by google translator and many others website too.
 
 
  	  | Quote: |  	  | ...The code below is a little clearer and can be listed and read in a single file. | 
 Oh yes, if you use it on a simple CE Trainer, the method is the best for this,
 
 Btw, my goal is provides an overview for application development in at least the Lua programming language, if you have an interest in that and is not limited to CE Lua only.
 
 The sample that I gave earlier was to provide a brief explanation of how the multi-language application works. At least in many applications and websites.
 _________________
 
 Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
 |  |  
		| Back to top |  |  
		|  |  
		| AylinCE Grandmaster Cheater Supreme
 
  Reputation: 37 
 Joined: 16 Feb 2017
 Posts: 1528
 
 
 | 
			
				|  Posted: Sat Jan 28, 2023 10:14 am    Post subject: |   |  
				| 
 |  
				| I appreciate that you take a broad view of many situations and take into account the final results. And you know that I try to repeat that appreciation as much as possible. ((Rep) Thumbs up)
 
 Okay, just "A wealth of different ideas." let's say.
   _________________
 
 |  |  
		| Back to top |  |  
		|  |  
		| Corroder Grandmaster Cheater Supreme
 
  Reputation: 75 
 Joined: 10 Apr 2015
 Posts: 1668
 
 
 | 
			
				|  Posted: Sun Jan 29, 2023 7:58 pm    Post subject: |   |  
				| 
 |  
				| Another implementation using set metatable as i18. (google to learn it). 
 
  	  | Code: |  	  | local i18n = { locales = {} } local currentLocale = 'en' -- the default language
 
 function i18n.setLocale(newLocale)
 currentLocale = newLocale
 assert(i18n.locales[currentLocale], ("The locale %q was unknown"):format(newLocale))
 end
 
 local function translate(id)
 local result = i18n.locales[currentLocale][id]
 return result
 end
 
 i18n.translate = translate
 setmetatable(i18n, {__call = function(_,...) return translate(id) end})
 
 i18n.locales.en = {
 helloWorld = "Hello world",
 loginWarning = "You need to be logged in to do that"
 }
 
 i18n.locales.es = {
 helloWorld = "Hola mundo",
 loginWarning = "Debes haber iniciado una sesión para hacer eso"
 }
 
 i18n.locales.cn = {
 helloWorld = "你好世界",
 loginWarning = "您需要登录才能执行此操作"
 }
 
 i18n.locales.tr = {
 helloWorld = "Selam Dünya",
 loginWarning = "Bunu yapmak için giriş yapmalısın"
 }
 
 Used = [[
 tr = i18n.translate
 i18n.setLocale('cn')
 txt1 =  tr('helloWorld')..'\n'..tr('loginWarning')
 print(txt1)
 
 i18n.setLocale('tr')
 txt1 =  tr('helloWorld')..'\n'..tr('loginWarning')
 print(txt1)
 ]]
 
 ---- on form example
 if fm then fm.destroy() end
 fm = createForm()
 cb = createComboBox(fm)
 cb.setPosition(10,10)
 cb.Width = 120
 bt = createButton(fm)
 bt.setPosition(150,9)
 bt.Width = 120
 bt.Caption = "Hello world"
 lb = createLabel(fm)
 lb.setPosition(10, 50)
 lb.Caption = "You need to be logged in to do that"
 
 cb.Clear()
 cb.Items.Add('English')
 cb.Items.Add('Spanish')
 cb.Items.Add('Chinese')
 cb.Items.Add('Turkish')
 cb.ItemIndex = 0
 
 function cbChange()
 idx = cb.ItemIndex
 if idx == 0 then
 i18n.setLocale('en')
 elseif idx == 1 then
 i18n.setLocale('es')
 elseif idx == 2 then
 i18n.setLocale('cn')
 elseif idx == 3 then
 i18n.setLocale('tr')
 else
 return idex
 end
 tr = i18n.translate
 bt.Caption = tr('helloWorld')
 lb.Caption = tr('loginWarning')
 end
 
 fm.show()
 cb.OnChange = cbChange
 | 
 
 Also, if someone interesting, look for MS learn how to use GetLocaleInfo windows API.[/code]
 _________________
 
 Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
 |  |  
		| Back to top |  |  
		|  |  
		|  |  
  
	| 
 
 | You cannot post new topics in this forum You cannot reply to topics in this forum
 You cannot edit your posts in this forum
 You cannot delete your posts in this forum
 You cannot vote in polls in this forum
 You cannot attach files in this forum
 You can download files in this forum
 
 |  |