iGatiTech
iGatiTech

Reputation: 2268

Set days name as per the language localization

I am facing an issue with showing day names as per the selected language. I have already set the locale parameter. As you can see in the attached screenshot, I am able to convert the month name. However, days are still showing in the English language only. Can anyone help please?

var modalPicker = new ModalPickerViewController(ModalPickerType.Date, AppResource.Date_Title, recordController)
            {
                HeaderBackgroundColor = UIColor.FromRGB(237, 237, 237),
                HeaderTextColor = UIColor.FromRGB(109, 109, 109),
                ModalPresentationStyle = UIModalPresentationStyle.Custom
            };

            
            modalPicker.DatePicker.Locale = new Foundation.NSLocale("es");
            modalPicker.DatePicker.Mode = UIDatePickerMode.Date;
            NSDate preSelectedDate = GetFormattedDate(textField.Text, "MM/dd/yyyy");

modalPicker.OnModalPickerDismissed += (s, ea) =>
            {

            };
        
                recordController.PresentViewController(modalPicker, true, null);

enter image description here

Upvotes: 1

Views: 107

Answers (1)

大陸北方網友
大陸北方網友

Reputation: 3767

Generally, the language of the "UIDatePicker" will change according to the system language you choose. You don’t need to write code manually to modify it.

But if you want to set another language "es-ES" for UIDatePicker, you can create a new string key Localization native development region in the Info.plist file and set it to es-ES.

enter image description here

Upvotes: 2

Related Questions