Questions tagged [nslocale]

Locales encapsulate information about linguistic, cultural, and technological conventions and standards. Examples of information encapsulated by a locale include the symbol used for the decimal separator in numbers and the way dates are formatted. Locales are typically used to provide, format, and interpret information about and according to the user’s customs and preferences. They are frequently used in conjunction with formatters.

257 questions
0
votes
3 answers

swift get currencycode from country code

I find the accepted answer to get currencycode from country code in objective c here - How to get ISOCurrencyCode from a ISOCountryCode in iphone sdk? Can someone help with the swift code to do the same ?
user1452936
  • 555
  • 1
  • 6
  • 14
0
votes
1 answer

NumberFormatter, NSLocale, Xcode, iOS, Swift 3.0

Problem: A textField with a "number" containing a decimal separator (a comma in my case), how can I change this to a decimal separator that Xcode will understand (.), and the other way around - display a result with the local decimal…
0
votes
0 answers

How to get dialing code of all countries through libPhoneNumber-iOS library?

I'm using the libPhoneNumber-iOS library to get the supported regions and verify the user phone number is valid or not. But I'm not able to find any method which returns me the country dialing code(like +91 for India). Is this achievable through…
Logunath
  • 477
  • 1
  • 8
  • 20
0
votes
2 answers

Swift using NSLocale for date formatter - need to set country automatically

I have found the below example and it seems to work in both am-pm mode and 24 hour mode. The problem is I want to set the locale identifier automatically depending on the user's country. I did not find a list with the countries or a method to do it…
asheyla
  • 3,175
  • 5
  • 18
  • 34
0
votes
2 answers

Can NSDateformatter be used for reading swedish months

I am trying to parse a list of dates. The dates look like this: "01MAY16, 01JUN16, 01AUG16" and so on. Up until now the dates have all been in english and I have successfully used the NSDateFormatter like this: let dateFormatter =…
fisher
  • 1,286
  • 16
  • 29
0
votes
1 answer

Search through NSArray of objects with different locale

I have an array of phone number objects, the phone number model is as follows: @property NSString *hotlineName; @property NSString *hotlineNameAr; @property NSString *hotlineNumber; @property NSString *hotlineImage; @property NSInteger…
Olla Ashour
  • 301
  • 1
  • 11
0
votes
0 answers

Primary ISO country code (or `NSLocale`) from currency identifier? (i.e. not alphabetical first country using a currency)

So, consider the following function: + (NSLocale *)localeWithCurrencyCode:(NSString *)currencyCode { for (NSString *localeIdentifier in [NSLocale availableLocaleIdentifiers]) { NSLocale *locale=[[NSLocale alloc]…
Ben Guild
  • 4,881
  • 7
  • 34
  • 60
0
votes
1 answer

Find decimal mark character based on locale

The decimal mark can be a dot or comma based on the locale. How can I determine which one it is? I have read through the docs on Formatting Data Using the Locale Settings but cannot figure out how do this.
Zia
  • 14,622
  • 7
  • 40
  • 59
0
votes
1 answer

How can I make NSLocale.autoupdatingCurrentLocale() return just the date?

NSLocale.autoupdatingCurrentLocale() makes formatting i18n dates really easy. For example: NSDate().descriptionWithLocale(NSLocale.autoupdatingCurrentLocale() Returns: Monday, February 1, 2016 at 12:00:00 PM Pacific Standard Time Is there a way I…
brandonscript
  • 68,675
  • 32
  • 163
  • 220
0
votes
2 answers

Easy way to check for continents using NSLocale, NSLocaleCountryCode?

Is there a way to check if the user's current country is in Europe, Asia or Africa? I working on an app that does something different for the UK and the US. I want to extend that logic so if the user's locale is set to a country in Europe, then I…
gobob
  • 412
  • 1
  • 4
  • 17
0
votes
1 answer

Which NSLocale to use with uppercaseStringWithLocale:?

When I have an UI string with capital letters, i'm used to define them in lowercase as for all the others, and then to use uppercaseStringWithLocale:[NSLocale currentLocale]. But recently I happened to notice that the [NSLocale currentLocale] may…
Imotep
  • 2,006
  • 2
  • 25
  • 38
0
votes
1 answer

Change string in iOS with respect to System language

I would like to display date in below format Jan 23, week 2, 2015. On Change of Language settings week string is remain in english others changed system language, So i have implemented Localization for the word "week" using localizable.string file…
Gobi M
  • 3,243
  • 5
  • 32
  • 47
0
votes
2 answers

How to Localize project depending on Region?

I have some features and Strings depending on the Region of the App. That region also speaks English . As per my knowledge NSLocalization only depends on the language user chooses. I want to change the String depending on the region. How to achieve…
coreDeviOS
  • 1,468
  • 2
  • 14
  • 27
0
votes
1 answer

NSLocale force a calendar type

[NSLocale currentLocale] may returns <__NSCFLocale: 0x7ff708516540> 'en_US@calendar=japanese'} Question: can I say NSLocale do not append calendar=japanese to locale.
Arsen
  • 10,815
  • 2
  • 34
  • 46
0
votes
2 answers

NSDateFormatter.dateFromString returns nil ("yyyy-MM-dd" to NSDate)

Having a problem with NSDateFormatter. So I have a date string formatted "yyyy-MM-dd", for example 2015-09-22. However when I pass this into NSDateFormatter.dateFromString, the method returns nil. My code is as follows: let dateFormatter =…
Jacob King
  • 6,025
  • 4
  • 27
  • 45