views:

1076

answers:

2

I'm trying to localize a UIDatePicker. Apple's docs say that it should autodetect the current locale, yet the language stays the same, no matter what language I select. What do I have to do?

A: 

the UIDatePicker has a locale property; if you don't set it it should default to the user's preferred locale. When you say "no matter what language I select" what do you mean--are you trying to change the locale programmatically, or are you changing the device's default locale using the Settings page?

David Maymudes
I'm referring to the International setting in Preferences. I have everything else set up to be an NSLocalizedString, and it all translates wonderfully. However, say I set the language to French in Preferences. My UIDatePicker will not display months in French. I have not set the locale at all, so I figured that this should display the correct locale. However, it's not.
how are you initializing the date picker? are you leaving the locale and calendar properties set to nil, or are you setting them to something?
David Maymudes
They are set to nil.
Also, I'm initializing the datePicker completely by code. Here's my code on pastebin. http://pastebin.com/m51df66f7
+2  A: 

The locale property (and all other country specific format properties for that matter) defaults to the value returned by currentLocale, which in turns depends on the iphone's country settings, not the language settings. You need to set the appropriate country in the iphone general settings.

Koffeinfrei