我有一个本地化的应用程序,我想将英语设置为默认语言,但使用" international"格式:
我想将此设置为全局应用设置,我无法使用此注释(如其他帖子中所示),并且解决方案不应该是特定于视图的。
换句话说,我正在寻找一个" en-INTERNATIONAL"的CultureInfo。
答案 0 :(得分:1)
我不是100%关于这个,所以如果我错了,请随时纠正我,但这可能有用:
<强>的Global.asax.cs 强>
protected void Application_BeginRequest()
{
var cultureInfo = CultureInfo.GetCultureInfo("en-GB");
Thread.CurrentThread.CurrentCulture = cultureInfo;
Thread.CurrentThread.CurrentUICulture = cultureInfo;
var numberFormat = new NumberFormatInfo();
numberFormat.PercentDecimalSeparator = ",";
numberFormat.CurrencyDecimalSeparator = ",";
numberFormat.NumberDecimalSeparator = ",";
numberFormat.NumberGroupSeparator = ".";
Thread.CurrentThread.CurrentCulture.NumberFormat = numberFormat;
}
答案 1 :(得分:0)
改编自blackn1ght对WPF的回答(原始要求)
private void Application_Startup(object sender, StartupEventArgs e)
{
var cultureInfo = CultureInfo.GetCultureInfo("en-GB");
var numberFormat = new NumberFormatInfo();
numberFormat.PercentDecimalSeparator = ",";
numberFormat.PercentGroupSeparator = ".";
numberFormat.CurrencyDecimalSeparator = ",";
numberFormat.CurrencyGroupSeparator = ".";
numberFormat.NumberDecimalSeparator = ",";
numberFormat.NumberGroupSeparator = ".";
culture.NumberFormat = numberFormat;
Dispatcher.Thread.CurrentCulture = cultureInfo;
Dispatcher.Thread.CurrentUICulture = cultureInfo;
}
日期格式dd / MM / yyyy在英国使用,因此en-GB应满足该要求。