在我的应用中,我希望语言设置为法语,日期格式也是如此。 但是我想读取带小数点的数字格式(英文格式而不是法文格式(法文格式带逗号))
这可能吗? 我想象的是:
public App()
{
System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CreateSpecificCulture("fr-FR");
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("???");
有什么想法吗?
答案 0 :(得分:2)
您只需更改文化的decimal
分隔符:
var culture = CultureInfo.CreateSpecificCulture("fr-FR");
culture.NumberFormat.CurrencyDecimalSeparator = ".";
答案 1 :(得分:0)
您可以这样使用:
CultureInfo CustomCulture = new CultureInfo("fr-FR");
CustomCulture.DateTimeFormat = new CultureInfo("en-US").DateTimeFormat; // Change DateTimeFormat to make date always in en-US Culture
Thread.CurrentThread.CurrentCulture = CustomCulture;
Thread.CurrentThread.CurrentUICulture = CustomCulture;
////Date Formats
Thread.CurrentThread.CurrentCulture.DateTimeFormat.FullDateTimePattern = "dd MMMM yyyy Hh:mm:ss";
Thread.CurrentThread.CurrentCulture.DateTimeFormat.LongDatePattern = "dd MMMM yyyy";
Thread.CurrentThread.CurrentCulture.DateTimeFormat.LongTimePattern = "HH:mm:ss";
Thread.CurrentThread.CurrentCulture.DateTimeFormat.MonthDayPattern = "d MMMM";
Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern = "dd-MM-yyyy";