Localizing UIDatePicker

Discussion in 'iOS Development' started by spoonforknife, Jul 16, 2009.

  1. spoonforknife

    spoonforknife Retired Moderator

    Joined:
    Nov 15, 2007
    Messages:
    6,896
    Likes Received:
    317
    Can UIDatePickers be localized? The documentation says that UIDatePickers should utilize the current locale immediately, so I'm not sure what I'm doing wrong.
  2. ZunePod

    ZunePod Banned

    Joined:
    Aug 28, 2008
    Messages:
    1,340
    Likes Received:
    0
    Device:
    iPhone 3G (Black)
    You could use NSDate to find it?

    Or maybe, if the user has a 3GS or 3G, you could find which timezone they are in, and set up a server to see what date it is.

    This is the long method though.
  3. bddckr

    bddckr Active Member

    Joined:
    Dec 2, 2007
    Messages:
    1,434
    Likes Received:
    18
    Device:
    iPhone 4 (Black)
    Aren't UIDatePickers localized by the system? I mean... it's the default behaviour or am I wrong here? Thought it uses the user's time format settings.
  4. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    I'm absolutely confused. What are you trying to do?
  5. spoonforknife

    spoonforknife Retired Moderator

    Joined:
    Nov 15, 2007
    Messages:
    6,896
    Likes Received:
    317
    In short, I want this:

    Please Register or Log in to view images



    to be in the correct locale, (i.e.) I want March to say Marzo if Spanish is selected.
  6. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    I've searched google, iPhone developer forums and ModMyI, seems as though this is a issue brought up by the community a lot.

    I think the best you can do is report the bug to apple at http://radar.apple.com
  7. bddckr

    bddckr Active Member

    Joined:
    Dec 2, 2007
    Messages:
    1,434
    Likes Received:
    18
    Device:
    iPhone 4 (Black)
    Had a quick look myself, it's a shame that the items of UIDatePicker are not translated by the system when changing the language. I just expected it to work... Yep I would recommend a bug report, too.
  8. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    Inside the picker are simply UITables (possibly UITableViews, but I would he surprised if they were).

    So, use your Objective-C knowledge to het those tables, access the correct cells, and set localizable strings or titles. It shoul be fairly straightforward. You could try to create a new category, or get down and dirty with runtime.h. It's your call, but it should be fairly easy regardless of method.

    Don't let a little thing like an OS bug stop you.
    : )
  9. ollyb303

    ollyb303 New Member

    Joined:
    Jun 10, 2010
    Messages:
    1
    Likes Received:
    0
    @SkylarEC - any idea how you would that?

    I know this an old post, but it's all I can find on the subject and this is exactly what I need to do...

    Many thanks...

Share This Page