我添加了带有日期(以天为单位,日期和月份以字母为单位)的标签,但我还需要它来显示正确的语言。
我有这个标签:
<Label Text="{Binding Date, StringFormat='{0:dd MMMM}'}"></Label>
我已经在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));
}
}
}
我已经尝试了很多东西,但是我怎么能以某种方式添加它:
CultureInfo MyCultureInfo = new CultureInfo("se-SE");
所以用我想要的语言说十月。
非常感谢!
答案 0 :(得分:0)
您没有说是否使用基于resx/resw
的本地化或OS本机。...
System.Globalization.CultureInfo.DefaultThreadCurrentCulture = new System.Globalization.CultureInfo("se-SE");
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("se-SE");
Globalizing Xamarin.Forms Code
您可以在表格级别设置文化
AppResources.Culture = new CultureInfo("se-SE");