I have an Xamarin.Forms app that supports both English and French. How do I show the Calender (Month, Day of the Week text) for the DatePicker in French locale?
I've tried Xamarin.Forms
public void SetLocale(CultureInfo ci)
{
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;
Console.WriteLine("CurrentCulture set: " + ci.Name);
}
I've tried changing the context before creating the datepicker dialog in my DatePicker custom renderer
var config = new Android.Content.Res.Configuration { Locale = Locale.CanadaFrench };
Context.Resources.UpdateConfiguration(config, Context.Resources.DisplayMetrics);
_dialog = new DatePickerDialog(Context, (o, e) =>
{
view.Date = e.Date;
((IElementController)view).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
}, year, month, day);
I also tried this in my DatePicker custom renderer protected override void
OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.DatePicker> e)
{
base.OnElementChanged(e);
this.Control.TextLocale = Locale.CanadaFrench;
}
None of these did anything to change the locale.
I also found this post that seems have done changing the calendar view to a different locale Set Android DatePicker title language But it wasn't clear how it was accomplished.