Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How in iOS to localize text of the month in UIDatePicker, and if it is possible at all?

I make search and up to now I see that UIDatePicker is working with localization of the device.

I have app which has internal lozalization. I need to change month's text dependantly of my internal localization. As I read it appears that this is not possible - I have to make my own custom picker.

Is there a way to achieve that without custom Dat picker?

like image 841
new2ios Avatar asked Jun 01 '15 09:06

new2ios


People also ask

What is Uidatepicker?

A control for inputting date and time values.

What is DatePicker in Swift?

Overview. Use a DatePicker when you want to provide a view that allows the user to select a calendar date, and optionally a time. The view binds to a Date instance. The following example creates a basic DatePicker , which appears on iOS as text representing the date.


1 Answers

Use locale property of UIDatePicker. I can't see any signs that the property is deprecated.

This code will localize picker to Japanese.

[datePicker setLocale: [NSLocale localeWithLocaleIdentifier:@"ja"]];

Replace "ja" with any language code you need.

like image 167
Andrey Kuznetsov Avatar answered Oct 29 '22 10:10

Andrey Kuznetsov