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.
Questions tagged [nslocale]
257 questions
0
votes
0 answers
Convert state name of a country to ISO code in iOS
I am using an API for getting data based on state's ISO code. For example, Haryana = HR, California - CA. Here, I don't know how to get state's name in ISO format (2 letter). Please help me regarding this

Pradheep Narendran P
- 419
- 3
- 16
0
votes
0 answers
NSDate comparison confusion
I have:
NSString *dateOfBirth = @"1997-01-13T00:00:00+1000"
I then present to the user a date picker to allow them to choose a date to compare with the above dateOfBirth string representation of a date.
Assuming they choose 1997-01-13 as the NSDate…

pnizzle
- 6,243
- 4
- 52
- 81
0
votes
1 answer
How can I reverse lookup a localized string
I am interested in finding the localized string key for a given text on the screen.
Is this possible ?
For instance in a contrived example:
UILabel *label = [[UILabel alloc] initWithFrame:frame];
label.text = NSLocalizedString(@"The key for this…

Avba
- 14,822
- 20
- 92
- 192
0
votes
1 answer
Why is NSFormatter dateFromString occasionally returning nil?
I have a method to convert a string in a specific format into an NSDate but it occasionally returns nil.
- (NSDate *)dateFromString:(NSString *)dateAndTime
{
NSDate *date;
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
…

kraftydevil
- 5,144
- 6
- 43
- 65
0
votes
2 answers
Word delimiter for given locale
How do I know if a language NSLocale uses spaces for delimiting words in a sentence (like English or other roman languages) or not (like Japanese)?
I expected to find this information under NSLocale Component Keys … no. Any idea? Do I really need to…

Bernd
- 11,133
- 11
- 65
- 98
0
votes
1 answer
NSLocale Language Names In Local Script
I am trying to get Xcode to return a list of iOS language names in a variety of formats. In the code below I have created a dictionary returning a variety of strings that I could get returned from NSLocale.
langInUsersLang - Returns the language…

dgee4
- 381
- 3
- 16
0
votes
1 answer
iOS Simulator: Changing language does not change format of [NSDate date] output
I'm trying to write tests for a piece of code I wrote that converts dates to en_US_POSIX using an NSDateFormatter. The tests seem to launch an iOS simulator when running, and changing the language here seems to also change the language used when…

Argus9
- 1,863
- 4
- 26
- 40
0
votes
1 answer
NSDate change to local format xcode 5.1.1
I selected the Arabic date in my device but i have to send the that date to the server in US format.
Please help me.
I'm using this code ::
NSTimeZone *timeZone = [NSTimeZone systemTimeZone];
[dateFormatter setTimeZone:timeZone];
…

Ravikumar
- 85
- 1
- 16
0
votes
2 answers
How to detect the system time format change in ios?
I want to detect the time format change done in the system setting. I used following code but it always give me the time old format. How can i get new time format?
#pragma mark
#pragma mark - application change time…

Chirag Shah
- 3,034
- 1
- 30
- 61
0
votes
2 answers
String to date conversion not working when language changed
Hi this is my code it is working fine when the device language is in English but when I change the change the language in french the date comes as nil.. Can anyone please help me to fix this problem.
NSDateFormatter *dateFormat =…

TamilKing
- 1,643
- 1
- 12
- 23
0
votes
1 answer
After NSChineseCalendar Deprecated in iOS 8.0, How can I get ChineseCalendar now?
After NSChineseCalendar Deprecated in iOS 8.0, How can I get ChineseCalendar now?
in the Documentation
NSChineseCalendar
Identifier for the Chinese calendar.
Available in iOS 2.0 and later.
Deprecated in iOS 8.0.

thisisName
- 45
- 1
- 4
0
votes
1 answer
Check if English language is set
I'd like to check which language is set on the device.
Here I get the language:
NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0];
But how can I check if english is set with an if-statement?

user3550084
- 71
- 2
- 9
0
votes
2 answers
Issues with localising greeting message
I am just finishing up my first app and have been localising different features. I have one feature in my app that I am not sure if I can localise or not.
Basically, when users open my app, they are greeted with a message that says 'good afternoon',…

user3746428
- 11,047
- 20
- 81
- 137
0
votes
2 answers
Convert $ to Local Currency in Objective C
I've read questions about formatting a currency but nothing seems to provide me an answer with my question.
I tried the code suggestions I found but all i get were the same values with different currency symbols.
For example:
$1 -> ₩1
What I want to…

cessmestreet
- 2,298
- 3
- 22
- 42
0
votes
0 answers
How can I get a Country Code from the Country Name in iOS?
Say I have a country name like : "United States" and I want to convert it to "US". How do I do that?
I know how to do the opposite, but there doesn't seem to be a solution for this.

gran_profaci
- 8,087
- 15
- 66
- 99