[Disclaimer: This blog has no intentions to be a definitive opinion on Lua or Corona development. It is just an opinion under the perspective of a non-professional developer, working for the first time with both technologies. If you find anything wrong with the expressed opinions, please feel free to comment and I will revise the text.]
My app must be international. Saying that, I planned to allow it to find which is the current language setup in the device and, enabling the correct idiom according that. I created an “.idi” file for each language I am planning to reach. For example, the english.idi file contains:
line 1: Send Mail
line 2: More Picts
line 3: More Stories
and the list goes on…
Below the code I used to make the selection, according the information coming from the phone:
As you can see, I started getting the current language at line 2. Lines 21 to 27 select the correct .idi file and call the function loadIdiom, which reads the correct file and save all lines in a table (array). With this table, I will be able to call the correct string according the number of the line. For example, when I need to refer to string Send Mail, I will use translatedStrings, considering the string Send Mail is in the first line of the .idi file.
Hope it helps!