0

I need to localize the letters of the days above the datepickerdialog in android. I already fully localized the application to the desired language. Changed the background etc. For some reason though, the letters of the days ain't changing.

I'm currently trying to alter the dialog via a CustomDatepickRenderer, but haven't found the right properties.

enter image description here

1 Answer 1

1

You could use the custom renderer to set the current configuration.

Custom Renderer:

 [assembly: ExportRenderer(typeof(Xamarin.Forms.DatePicker), typeof(DatePickerDialogCustomRenderer))]
namespace App2.Droid
{
    class DatePickerDialogCustomRenderer : DatePickerRenderer
    {
    public DatePickerDialogCustomRenderer(Context context) : base(context)
    {
    }
    protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.DatePicker> e)
    {
        base.OnElementChanged(e);
        var locale = Locale.English;
        this.Control.TextLocale = locale;
        Resources.Configuration.SetLocale(locale);
    }     
   }
 }

The Language of the device is Chinese. Use the code to set the language of the Days Line to English.

Before:

enter image description here

After:

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. In the end there was a problem in the culture configuration. When it was set to es-US or es-CL it didn't work, but when it was set to just "es" it changed as supposed to. I ended changing the localization of the whole application, but I like your answer better ^^.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.