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
1
vote
1 answer

Convert DateTime from English to Spanish in iPhone?

Does anybody know how to convert a DateTime from English to Spanish? E.g convert: December 07, 10:42AM into Diciembre 07, 10:42AM Please help me. How to convert this? Thanks in advance. I tried this: NSLocale *frLocale = [[[NSLocale alloc]…
SampathKumar
  • 2,525
  • 8
  • 47
  • 82
1
vote
1 answer

Can't query iOS for current user language

I'm trying to determine the user language in iOS. StackOverflow has several answers on this topic which has greatly helped me out, such as this one: Getting current device language in iOS? I can successfully retrieve the value I'm looking for in…
Jay Versluis
  • 2,062
  • 1
  • 19
  • 18
1
vote
2 answers

iOS: override NSLocale language

If you have a localized version of your app in several languages but if the user is not using any of the languages the app is localize. How to set a default language? Or what will be the best practice to define a default language in this case? Here…
Juan
  • 627
  • 2
  • 9
  • 27
1
vote
1 answer

NSDate issue with locale

I'm working on an iPad app that speaks to a private PHP API that I built up to communicate to a database. This API has to transfer Three dates, a starting time, an end time and the current time. I want to test if the current time is in-between the…
Julian F. Weinert
  • 7,474
  • 7
  • 59
  • 107
1
vote
1 answer

Class versus Instance method Obejctive-C calls - NSLocale methods

I am a very green nubie, anyways, I am working through a tutorial that walks me through using the NSLocale class to get the local currency, like this: NSLocale *here = [NSLocale currentLocale]; NSString *currency = [here…
jonathan3087
  • 313
  • 1
  • 4
  • 18
0
votes
1 answer

creating dynamic NSLocale with location data

I'm working on an app which should create an NSLocale object based NOT on the user's region (which should remain at the user's preferred language for most interface elements), but on the physical location of the traveler, to format currency. …
0
votes
1 answer

How does the Mac OS determine which localization.strings file to use?

I have and XCode project with a list of supported languages. By default, XCode only lists 4 default languages when you click on "Add Localization" on the Localized Group info window. I just followed a sample project and added Localizations in a mix…
radj
  • 4,360
  • 7
  • 26
  • 41
0
votes
0 answers

iOS Swift app - 24 hour format from Settings app is not respected for Germany and France

I have to display date and time in an iOS app based on locale (Region) and time format (24-Hour vs 12-Hour) set in the device Settings app. I am using below code for the same :- class func getDateTimeString(_ fromDate: Date?) -> String { var…
letsbondiway
  • 470
  • 3
  • 18
0
votes
0 answers

find device language with swift

I want to learn to the language of the iPhone. on my own device and the simulator works fine. for example changing the language and region to ukraine it works. but when real users in ukraine or croatia running it, currentLanguage always returns…
ursan526
  • 485
  • 3
  • 10
0
votes
1 answer

NSNumberFormatter - get currency symbol for currency code

This question is similar to, but there was no answer that worked on that question - NSNumberFormatter currency symbol I am using an NSNumberFormatter to format currency values and this works fine as long as the currency is the currency of the…
ashipma
  • 423
  • 5
  • 15
0
votes
1 answer

NSLocale identification

Can anyone please tell me why the following code gives the opposite result in a machine with en_US locale identifier ? if([[[NSLocale currentLocale] localeIdentifier] compare:@"en_US"] == NSOrderedSame) {NSLog(@"True");}…
Dimitris_Al
  • 25
  • 1
  • 7
0
votes
2 answers

Display currency symbols using currency codes in iPhone SDK

Actually, I want to display the currency symbols of all currency codes and I'm using code like this,but i only get "$" symbols -(void) showCurrenciesList { NSNumberFormatter *numFormatter = [[NSNumberFormatter alloc] init]; …
NSS
  • 721
  • 1
  • 10
  • 23
0
votes
1 answer

NSDateFormatter returns nil for date 13 Jan 2020 05:22:03 -0800

I am trying to formate email dates but date formatter returns nil where last five characters -0800. Doesn't have any problem with date has +0000. I have list of mixed dates of emails ending with +0000 and -0800 How can I add that 8 hours difference…
0
votes
0 answers

NotificationService Extension returns different locale than App target

I'm trying to get my current locale in the app and in the NotificationService extension. The code looks like this: let locale = Locale.current.identifier In the app target the locale is de_DE and in the NotificationService extension it evaluates to…
Nico S.
  • 3,056
  • 1
  • 30
  • 64
0
votes
2 answers

How to rename the currency code to the full name of the currency? Swift

I created this method. I have an array of currency code. But when I insert a code, for example: “USD”, the method returns me Optional (“US dollar”). And whenever I try to extract an option, I get a nil. What did I do wrong? func…