Localize a currency for the in-app price tag

Getting into LiveCode for iOS? Ask your questions here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
Jellobus
Posts: 239
Joined: Tue Dec 10, 2013 2:53 pm

Localize a currency for the in-app price tag

Post by Jellobus » Sun Mar 10, 2019 9:50 pm

Hi guys,

How to localized in-app price tags depend of the countries? so how to find out a money currency setting used by the App Store?

For example, App should show US dollar to users registered in the US App Store, Japanese Yen to users registered in the Japanese App Store.

I checked both mobilePreferredLaguages, mobileCurrentLocale. They return language and country settings but they don’t mean anything about the money currency settings in the device. Even though it returns "US" or "JP" for country setting, the money currency can be anything depends on the App Store's country setting.

Any suggestions?

Thanks a million in advance,,

Louis

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3063
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Localize a currency for the in-app price tag

Post by richmond62 » Mon Mar 11, 2019 11:24 am

All I can suggest is to "tie" currency to locale, so:

Code: Select all

switch mobileCurrentLocale() 
case "en_UK" 
  updateDisplay "english"
  put "£" into CURRENCY
  break
  case "en_US"
  update display "english"
  put "$" into CURRENCY
  break
  case "yo_NG"
  update display "yoruba"
  put "Naira" into CURRENCY
  break
  end switch
 
end if
https://docs.oracle.com/cd/E13214_01/wl ... codes.html

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3063
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Localize a currency for the in-app price tag

Post by richmond62 » Mon Mar 11, 2019 2:25 pm

Sorry, instead of putting "Naira" into my sample code
I should have put "NGN":

https://www.iban.com/currency-codes

It might be better, and easier to handle if one were to use the numeric codes
for currencies.

So, for Nigeria one might use 566.
-
Nigeria_naira.jpg
-
Currently running at about 362 to the United States dollar.

Jellobus
Posts: 239
Joined: Tue Dec 10, 2013 2:53 pm

Re: Localize a currency for the in-app price tag

Post by Jellobus » Tue Mar 12, 2019 5:16 pm

Hi richmond62

mobileCurrentLocale() returns language and country settings but it does not provide the money currency setting in App Store. Even though it returns "en-US" for country setting, the money currency can be anything depends on the App Store's country setting.

Do you know how to find out the country setting of App Store?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3063
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Localize a currency for the in-app price tag

Post by richmond62 » Tue Mar 12, 2019 7:08 pm

Even though it returns "en-US" for country setting, the money currency can be anything depends on the App Store's country setting.
I must be missing something as that sentence seems to imply that the currency is
directly linked to the country setting.
-
Screenshot 2019-03-12 at 20.07.20.png
-
I cannot find a way to change the language (to, say, Scots) independently
of the "country" setting [the UK is not a country].

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4873
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Localize a currency for the in-app price tag

Post by jacque » Wed Mar 13, 2019 5:28 pm

The App Store handles currency conversions for you, and unless they provide an API to get that info I'm not sure you can retrieve it. I think once a user has purchased in-app, the response may provide the currency (I'm guessing) but that won't help if you want to display a cost before a purchase.

Do any other apps do this?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3063
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Localize a currency for the in-app price tag

Post by richmond62 » Wed Mar 13, 2019 5:39 pm

Do any other apps do this?
All apps display a price pre-purchase:
-
Screenshot 2019-03-13 at 18.38.51.png
-
Presumably the currency is determined by the country setting of the App-Store,

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4873
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Localize a currency for the in-app price tag

Post by jacque » Wed Mar 13, 2019 6:52 pm

richmond62 wrote:
Wed Mar 13, 2019 5:39 pm
Do any other apps do this?
All apps display a price pre-purchase:
-
Screenshot 2019-03-13 at 18.38.51.png
-
Presumably the currency is determined by the country setting of the App-Store,
Right, but that's in the App Store itself. The question was how to query that currency from within the app and display it in the app without sending the user to the store to look it up.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3063
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Localize a currency for the in-app price tag

Post by richmond62 » Wed Mar 13, 2019 7:16 pm

The question was how to query that currency from within the app and display it in the app
I wish you had stated that as clearly as you did just now earlier on. 8)

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3063
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Localize a currency for the in-app price tag

Post by richmond62 » Wed Mar 13, 2019 7:22 pm

Just go back to my code I offered above.

NO: it will not retrieve a state's currency, but it will retrieve the code for
the state the computer is domiciled in [and I mean "domiciled" rather than is physically present]
and then from a look-up list you can find the currency that is relevant.

Jellobus
Posts: 239
Joined: Tue Dec 10, 2013 2:53 pm

Re: Localize a currency for the in-app price tag

Post by Jellobus » Thu Mar 14, 2019 7:11 pm

Here is my experiment with iPhone.

-Region setting: United States
-Country setting of the App Store ID(App Store): Japan <-- You can not find country setting of a user ID in the phone, You only able to choose a country when register the Apple ID.

With this settings,
1.mobileCurrentLocale() returns "en_US"
2.App Store shows Japanese yen ¥ as a default currency because country setting of App Store is Japan.

This scenario can happen when Japanese users travel to US. By using mobileCurrentLocale(), the currency of the price tag "in the app" (Not the store front) will be US dollar while the App Store's default currency is Japanese Yen. This will confuse users.

But is mobileCurrentLocale() still the best option?
I have implemented mobileCurrentLocale() but it will be great if anyone suggest a option..

Cheers,

Post Reply

Return to “iOS Deployment”