0

I've added a label with the date in days and the month in letters but I need it to show the right language also.

I've got this label:

<Label Text="{Binding Date, StringFormat='{0:dd MMMM}'}"></Label>

I've got this in the ViewModel:

public class EventPageViewModel : INotifyPropertyChanged
{
    private readonly INavigationService _navigationService;
    //public DelegateCommand Date { get; set; }

    public EventPageViewModel(INavigationService navigationService)
    {
        _navigationService = navigationService;
    }

    DateTime _startdate;
    public DateTime Date
    {
        get
        {
            return _startdate;
        }
        set
        {
            _startdate = value;
            RaisePropertyChanged("Date");

        }
    }

    public event PropertyChangedEventHandler PropertyChanged;

    protected void RaisePropertyChanged(string propertyName)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}

I have tried lots of things but how can i somehow add this:

CultureInfo MyCultureInfo = new CultureInfo("se-SE");

So that is say October in my desired language instead.

Thanks alot!!

KalleP
  • 319
  • 4
  • 16

1 Answers1

0

You did not say if you are using resx/resw-based localization or OS native....

Setting the default thread culture:

System.Globalization.CultureInfo.DefaultThreadCurrentCulture = new System.Globalization.CultureInfo("se-SE");

Setting the culture at the individual thread level..

Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("se-SE");

Setting it via Xamarin.Forms localization:

Globalizing Xamarin.Forms Code

You can set the culture at the Forms level

AppResources.Culture =  new CultureInfo("se-SE");
SushiHangover
  • 73,120
  • 10
  • 106
  • 165