Issue
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.
Solution
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:
After:
Answered By - Wendy Zang - MSFT
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.