localization

I downloaded Corona today and I’m very suprised that Corona has no support for localization!

Perhaps I’m wrong and I have just found nothing in the docs and the forum but I’ve looked in the example app “HelloWorldLocalized” and this is NOT what I call localization support.

Before buying a subscription I have to code a prototype an localization is essential. I still want to give corona a chance and coded localiatzion.lua:

module(..., package.seeall)  
  
local localizedText =  
{  
 ["tabMainView"] =  
 {  
 ["en"] = "no",  
 ["de"] = "yes"  
 },  
  
 ["tabSettings"] =  
 {  
 ["en"] = "test123",  
 ["de"] = "test234"  
 }   
}  
  
function GetLocalizedString(stringName)  
 local language = "de"  
 --local os = system.getInfo("platformName")  
 --if os == "Android" then  
 -- print( "system.getPreference is not implemented on Android yet" )  
 --else  
 -- language = system.getPreference( "ui", "language" )  
 --end   
  
 return localizedText[stringName][language]  
end  

Some questions to this code and localization with Corona in general:

  • Is my approach reasonable?
  • Will this work on iOS and Android? The example code says that this does not work with Android.
  • The commented out text does not work in the simulator. language always contains the value “1031”. Is this an issue with the simulator? [import]uid: 74852 topic_id: 20649 reply_id: 320649[/import]

Hey there,

I have not played with this myself but believe this may help you; http://monkeybin.no/blog/archives/2011/09/18/corona-sdk-localization-made-easy/ (Another member of the team recommended it.)

Peach :slight_smile: [import]uid: 52491 topic_id: 20649 reply_id: 81239[/import]

Thanks for the link. This seems to be the same approach so I’ll give it a try ;). [import]uid: 74852 topic_id: 20649 reply_id: 81257[/import]