views:

71

answers:

2

Hello all,

I have seen some localization examples but they were based on languages .

In my case I want to make my application in two versions : us and uk .

For that I can not depend on language as I have seen just English in the settings application .

there is no English(UK) or English(US) .

I want just some minor changes like $ or £ .

These changes I want to do in my code .

So should I make two different builds or there is a way to localize them.

Thanks.

+2  A: 

Easiest way would probably be to support both with the same build and let the user choose via a preference panel.

Thilo
Thanks for your good answer but suppose I don't want give any control to user i.e. the preferences panel then is there any other way to do so ?
hib
+1  A: 

What you're looking to do is detect different locales instead of languages. Things like currency symbols are supported by way of the NSLocale class.

For example to get the currency symbol use:

NSString *currencySymbol = [[NSLocale currentLocale] objectForKey:NSLocaleCurrencySymbol];

This solves your problem without the user having to configure specifically for your app; chances are good that the default for your app is likely the wrong setting for a good deal of your users with the preference approach.

Giao
Thnks Giao . So will the locale be changed automatically based on the iPhone is us or in uk or I have to give localizable.strings ?
hib
The localized strings are for language switches. Since you're using the same language in US and UK, that's not necessary. The up side of using locale is that your code will work in other regions where English is used such as Australia and English speaking Canada.
Giao
Can I test in simulator that the above line will give me £ in uk and $ in uk ?
hib
Giao
Thanks it is working . Nice .
hib