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
6
votes
2 answers

NSLocale of loaded language in application

In my interface I'm showing the display name of a locale with this: [[NSLocale currentLocale] displayNameForKey: NSLocaleIdentifier value: identifier] But this gives the display name using the locale of the system which is not always the same as…
Jef
  • 2,134
  • 15
  • 17
6
votes
4 answers

How to get OS language and locale?

My app changes the language at runtime and advises the user to restart the app. I do it like this: typealias LanguageLocaleType = (language: String?, locale: String?, title: String) let elements: [LanguageLocaleType] = [ (nil, nil,…
TruMan1
  • 33,665
  • 59
  • 184
  • 335
6
votes
2 answers

NSLocaleUsesMetricSystem always YES on iPad

I am trying to decide if the users Region/Locale settings validates the use of Metric values (in this case if kg or lb should be appended). I am running 3.2 on my iPad and on the simulator(Xcode 3.2.4). I have tried out a few different Region…
RickiG
  • 11,380
  • 13
  • 81
  • 120
6
votes
2 answers

iOS: plurals and custom locale

I'm developing app that supports "en" and "ru" languages, users can select language inside app. If default phone's locale set to "en", but inside app selected "ru" language, then when trying to localize plural sentence ignored 'many'/'few' form. So…
Mikhail
  • 4,271
  • 3
  • 27
  • 39
6
votes
3 answers

Swift - Get list of countries

How can I get an array with all countries names in Swift? I've tried to convert the code I had in Objective-C, which was this: if (!pickerCountriesIsShown) { NSMutableArray *countries = [NSMutableArray arrayWithCapacity: [[NSLocale…
rulilg
  • 1,604
  • 4
  • 15
  • 19
6
votes
2 answers

How to get system locale and system language in cocoa

I want to get the system default language and system locale. I have tried the following code snippet to get the system current locale as the following NSLocale *locale; locale = [NSLocale systemLocale]; NSString * localLanguage = [locale…
Akbar
  • 1,509
  • 1
  • 16
  • 32
5
votes
2 answers

iPhone display date using a user locale but in other language

Is there any solution to display to the user a date using his locale settings but the words to be in a different language? What I want is to display to a user that has set up en_US a date in german language (month names, weekdays for example).
CristiC
  • 22,068
  • 12
  • 57
  • 89
5
votes
1 answer

How to get NSNumberFormatter currency style from ISOCurrencyCodes?

If I were to have EUR, or USD (both ISO currency codes), how could I make my NSNumberFormatter to properly format me a string like this? For EUR code: 10.000,00 € For USD code: $10,000.00 I could do this by setting localeIdentifier. But I really…
nmdias
  • 3,888
  • 5
  • 36
  • 59
4
votes
2 answers

wrong decimal separator with NSDecimalNumber in iOS

I tried to output the description of a decimal number with the correct decimal separator in the following way: NSString* strValue = @"9.94300"; NSDecimalNumber* decimalNumber = [NSDecimalNumber decimalNumberWithString: strValue]; NSLocale*…
Waterman
  • 131
  • 3
  • 11
4
votes
1 answer

Reformat localized date string to another locale

I have a String that is "Jueves 14 Junio 1990": it is a date formatted in the es_MX locale, I want to convert that into a new string with en_US as the locale. This is my code: let myString:String = "Jueves 14 Junio 1990" let dateFormatter =…
Charlie Pico
  • 2,036
  • 2
  • 12
  • 18
4
votes
2 answers

iOS NSDateFormatter needs NSLocale even it's UTC

I have a doubt that I cannot understand why is the way it is and I appeal to the Gods of this site :) I have a date coming like this: "1982-01-01T00:00:00Z" As I'm displaying whatever the server sends (I know, customer requirement, not good…
4
votes
3 answers

Name order habit in iOS about NSLocale

As far as we know that in English speaking country, people always write their names down as format "FirstName MiddleName LastName", such as "Steven Paul Jobs". However in some other language, it is different, for example, in China, people usually…
4
votes
0 answers

Definite article before country name in sentence

I have an iOS app where I want to include the user's country (as defined by region) in a text string, e.g. “In Portugal this is …”. For most country names this is easy: let countryCode = locale.objectForKey(NSLocaleCountryCode) as! String …
beta
  • 2,380
  • 21
  • 38
4
votes
1 answer

iOS: How to retrieve locale strings for a specific locale than what the user has set in OS?

Is it possible to retrieve strings for a specific locale programmatically regardless of what locale the phone is set to? For example, users may be running the phone in English, but I want to retrieve French strings instead without changing the OS…
Boon
  • 40,656
  • 60
  • 209
  • 315
4
votes
2 answers

Set default language at first run IOS

I'm trying to set the language for my app at first run. After seeing this question, I decided to do the same. Setting default language for iPhone app on first run I adapted a bit the code, and made this: int main(int argc, char * argv[]) { …
Antzi
  • 12,831
  • 7
  • 48
  • 74
1 2
3
17 18