lilcodelab / Xamarin.Plugin.Calendar

Calendar plugin for Xamarin.Forms
MIT License
260 stars 61 forks source link

[Custom] Can't get Culture to work #94

Closed chinookproject closed 3 years ago

chinookproject commented 3 years ago

I have a minimal setup of the Calendar component. I want to change the language of the calendar to Dutch. But for some reason I can't get it to work.

In my xaml I have this:

<controls:Calendar
                    Culture="{Binding Culture}"
                    Month="5"
                    Year="2021"
                    MonthLabelColor="{StaticResource TextColor}"
                    ArrowsColor="{StaticResource TextColor}"
                    TodayOutlineColor="#FCB324"
                    SelectedDateColor="{StaticResource TextColor}"
                    SelectedDayBackgroundColor="Blue"
                    DaysTitleColor="Red"   
                    VerticalOptions="FillAndExpand"
                    HorizontalOptions="FillAndExpand" />

In my ViewModel I do something similar as in the Advanced Sample project:

        public string Cult { get; set; }

        private CultureInfo _culture = CultureInfo.CreateSpecificCulture("nl-NL");
        public CultureInfo Culture
        {
            get => _culture;
            set => RaisePropertyChanged(() => Culture);
        }

        public PlanningViewModel()
        {
            Culture = CultureInfo.CreateSpecificCulture("nl-NL");

            // Test current culture. See screenshot for output.
            var Cult = $"{Thread.CurrentThread.CurrentCulture.DisplayName} -- {Thread.CurrentThread.CurrentUICulture.DisplayName}";
        }

But for some reason all the labels in the calendar are always in English. I am testing this on a physical Android device where the language is set to Dutch.

Any idea what the issue could be?

image

chinookproject commented 3 years ago

Not sure why, but it seems to be working now.