Default Language

Hey,
I have an app which will be loaded to many App Stores (the US App Store, the German App Store etc…)
Is there a way to know which App Store the user is currently connected to?

I want the User to have his own native language when he starts the App, so If the App is being run on an iPhone which is currently connected to the US App Store, the language will be english, however if the App is being run from a device which is connected to the German Store, the language will be german.

Is there such a way?
Thanks [import]uid: 110965 topic_id: 30340 reply_id: 330340[/import]

You are kind of over complicating it. I should be able to buy from the German store and play in Spanish.

Your iPhone has a setting that you can access that gets the devices current language. This is the language your game should start in, not the language of the store it was downloaded from. Does that make sense?

lang = system.getPreference( "ui", "language" )  

This will set lang to a string that matches the ISO country code, i.e. “en” for English, “pt” for Portuguese, “pt-PT” for Portuguese spoken in Portugal, “de” for German, “es” for Spanish, etc.

Then your app can react to that string for however you want to handle your language. In my apps where I have graphics that contain text, I just make sure they have the language in the filename:

playButton_en.png
playButton_pt.png
playButton_fr.png

When I go to load the graphic:

playButton = display.newImageRect(“playButton_” … lang … “.png”, width, height)

[import]uid: 19626 topic_id: 30340 reply_id: 121562[/import]

I should also say you can do your strings like this:

hwText = {}  
hwText["en"] = "Hello World"  
hwText["fr"] = "Bonjour tout le monde"  
hwText["es"] = "Hola Tierra"  
  
hwDisplayText = display.newText(hwText[lang],0,0,"Helvetica",32)  
  

[import]uid: 19626 topic_id: 30340 reply_id: 121564[/import]

Thanks, that’s an elegant solution, but sadly, it may not suffice in this case.
The App is actually should work both in English and Hebrew. The problem with Hebrew, in this case, is that many people prefer to have English as their Setting Language while still connected to the Israeli App Store, because many here are used to Left-to-Right settings menus

So is there a way to know that? [import]uid: 110965 topic_id: 30340 reply_id: 121615[/import]

Hi,

I don’t believe there’s any way to do this, even when dealing natively with iOS/Xcode.

I’ve never come across any native API that let’s you see which App Store the user is configured to use.

Ali [import]uid: 10499 topic_id: 30340 reply_id: 121623[/import]

So give them a settings screen where they can switch languages and the above solution still works.

First you checked your settings to see what they’ve picked. If they haven’t picked anything, default to the info returned by the default language. [import]uid: 19626 topic_id: 30340 reply_id: 121667[/import]

Yup. That’s what we’ll do.
Thanks [import]uid: 110965 topic_id: 30340 reply_id: 121727[/import]

You are kind of over complicating it. I should be able to buy from the German store and play in Spanish.

Your iPhone has a setting that you can access that gets the devices current language. This is the language your game should start in, not the language of the store it was downloaded from. Does that make sense?

lang = system.getPreference( "ui", "language" )  

This will set lang to a string that matches the ISO country code, i.e. “en” for English, “pt” for Portuguese, “pt-PT” for Portuguese spoken in Portugal, “de” for German, “es” for Spanish, etc.

Then your app can react to that string for however you want to handle your language. In my apps where I have graphics that contain text, I just make sure they have the language in the filename:

playButton_en.png
playButton_pt.png
playButton_fr.png

When I go to load the graphic:

playButton = display.newImageRect(“playButton_” … lang … “.png”, width, height)

[import]uid: 19626 topic_id: 30340 reply_id: 121562[/import]

I should also say you can do your strings like this:

hwText = {}  
hwText["en"] = "Hello World"  
hwText["fr"] = "Bonjour tout le monde"  
hwText["es"] = "Hola Tierra"  
  
hwDisplayText = display.newText(hwText[lang],0,0,"Helvetica",32)  
  

[import]uid: 19626 topic_id: 30340 reply_id: 121564[/import]

Thanks, that’s an elegant solution, but sadly, it may not suffice in this case.
The App is actually should work both in English and Hebrew. The problem with Hebrew, in this case, is that many people prefer to have English as their Setting Language while still connected to the Israeli App Store, because many here are used to Left-to-Right settings menus

So is there a way to know that? [import]uid: 110965 topic_id: 30340 reply_id: 121615[/import]

Hi,

I don’t believe there’s any way to do this, even when dealing natively with iOS/Xcode.

I’ve never come across any native API that let’s you see which App Store the user is configured to use.

Ali [import]uid: 10499 topic_id: 30340 reply_id: 121623[/import]

So give them a settings screen where they can switch languages and the above solution still works.

First you checked your settings to see what they’ve picked. If they haven’t picked anything, default to the info returned by the default language. [import]uid: 19626 topic_id: 30340 reply_id: 121667[/import]

Yup. That’s what we’ll do.
Thanks [import]uid: 110965 topic_id: 30340 reply_id: 121727[/import]