简体   繁体   English

CultureInfo.GetCultures (CultureTypes.NeutralCultures) DisplayName 属性在应用程序发布时给出不同的结果

[英]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.

相关问题 为什么CultureInfo.GetCultures(CultureTypes.SpecificCultures)在不同的计算机上返回不同的文化集 - Why does CultureInfo.GetCultures(CultureTypes.SpecificCultures) return different sets of cultures on different computers 为什么我们从CultureInfo.GetCultures(CultureTypes.AllCultures)获得相同的CultureInfo.LCID - Why we get the same CultureInfo.LCID from CultureInfo.GetCultures(CultureTypes.AllCultures) 为什么 CultureInfo.GetCultures(CultureTypes.AllCultures) 中缺少某些文化? - Why are certain cultures missing from CultureInfo.GetCultures(CultureTypes.AllCultures)? 什么是CultureInfo.GetCultures是.NET Core - What is the equivalent of CultureInfo.GetCultures is .NET Core 为什么不在CultureInfo.GetCultures()中展示所有国家/地区? - Why not all countries are presented in CultureInfo.GetCultures()? 在.NET Windows应用商店应用中替换CultureInfo.GetCultures - Replacement for CultureInfo.GetCultures in .NET Windows Store apps .NET CultureInfo本地化的DisplayName - .NET CultureInfo Localized DisplayName C#应用程序配置文件给出不同的结果 - C# application profiling gives different results System.Globalization.CultureInfo.GetCultures在开发环境中返回null(Visual Studio) - System.Globalization.CultureInfo.GetCultures returning null in dev environment (Visual Studio) 我的 .net core 发布的可执行文件提供了与运行代码时不同的目录路径 - My .net core published executable gives a different directory path than when running the code
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM