Hello,
I recently started using Corona and I am not an experienced programmer so first of all sorry for my question.
After two weeks of intense “try and error” and not finding anything that helps me online I decided to post my question here, hopping for a solution
My book-app is a multi language one. Inside the few options in the menu there is one that allows to choose between three languages.
My plan was to create a Global Variable that ruled the language of the entire app, from the menu to the texts of the book.
Having all the three different language texts, this Global Variable would point at which language was chosen by the user. The image of three flags showed the options. Obviously one language must be offered by default ( stored in the global variable).
Anything I tried can’t change the default selection I provided and it makes impossible to choose any other language.
And here is the last code I tried, simplified:
[lua]
– language: Global Variable
_L = “es”
– Language Options
local textos = {}
textos.es = {“Espanol”, “Ingles”, “Ruso”}
textos.en = {“Spanish”, “English”, “Russian”}
textos.ru = {“Rus1”, “Rus2”, “Rus3”}
local es = display.newText( textos[_L][1], _W * 0.5, 80, native.systemFont, 36 )
es:setTextColor (255, 255, 255)
local en = display.newText( textos[_L][2], _W * 0.5, 120, native.systemFont, 36 )
en:setTextColor (255, 255, 255)
local ru = display.newText( textos[_L][3], _W * 0.5, 160, native.systemFont, 36 )
ru:setTextColor (255, 255, 255)
function en:tap(event)
_L = “en”
return _L
end
function es:tap(event)
_L = “es”
return _L
end
function ru:tap(event)
_L = “ru”
return _L
end
es:addEventListener (“tap”, es)
en:addEventListener (“tap”, en)
ru:addEventListener (“tap”, ru)
[/lua]
I understand it can be done but I can’t find how.
Thank you very much in advance.
Sergio