[英]CultureInfo.GetCultures (CultureTypes.NeutralCultures) DisplayName property gives different results when the application is published
Live:居住:
Local:当地的:
Code:代码:
<select name="Language" asp-for="Language" class="form-control" id="Language">
@foreach (var cultureInfo in Model.CultureInfos)
{
if (cultureInfo.TwoLetterISOLanguageName == "en")
{
<option selected value="@cultureInfo.Name">@cultureInfo.DisplayName</option>
}
else
{
<option value="@cultureInfo.Name">@cultureInfo.DisplayName</option>
}
}
</select>
This is probably because of the machine on which we publish the application.这可能是因为我们发布应用程序的机器。 But I don't know how we can solve this problem.但我不知道我们如何解决这个问题。 For example, is it enough to change the language of the machine?例如,改变机器的语言就足够了吗?
As mentioned in my comment, to fix it, we can use the EnglishName , instead of the DisplayName.正如我在评论中提到的,要修复它,我们可以使用EnglishName而不是 DisplayName。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.