Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/278.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 未为非基本语言选择正确的Resx文件_C#_Asp.net Mvc 4_Localization_Resx_Currentuiculture - Fatal编程技术网

C# 未为非基本语言选择正确的Resx文件

C# 未为非基本语言选择正确的Resx文件,c#,asp.net-mvc-4,localization,resx,currentuiculture,C#,Asp.net Mvc 4,Localization,Resx,Currentuiculture,我使用Microsoft MVC4为基础语言(如英语、法语、德语等)提供了一个可用的resx本地化设置,但我正在尝试将其扩展到更具体的语言(如简体/繁体中文) 我已使用建议的命名约定命名我的文件: SharedStrings.de.resx SharedStrings.es-es.resx SharedStrings.es.resx SharesStrings.fr.resx SharedStrings.resx SharedStrings.zh-cn.resx SharedStrings.zh

我使用Microsoft MVC4为基础语言(如英语、法语、德语等)提供了一个可用的resx本地化设置,但我正在尝试将其扩展到更具体的语言(如简体/繁体中文)

我已使用建议的命名约定命名我的文件:

SharedStrings.de.resx
SharedStrings.es-es.resx
SharedStrings.es.resx
SharesStrings.fr.resx
SharedStrings.resx
SharedStrings.zh-cn.resx
SharedStrings.zh-tw.resx
对,我正在应用程序_BeginRequest()中的Global.asax.cs中设置区域性 这样做:

CultureInfo ci = new CultureInfo(CultureInfo.CurrentCulture.Name);
ci = System.Globalization.CultureInfo.GetCultureInfo("zh-tw");
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;

当我加载页面时,虽然它没有拾取zh tw或es es,但奇怪的是它确实拾取zh cn、de、en等。我在这里有点迷路,所以我真的非常感谢您的帮助。

我终于找到了问题所在。当我使用VisualStudio2010生成名称resx文件时,它没有将它们作为嵌入式资源生成。解决此问题的方法是右键单击不工作的resx文件并选择“属性”。然后将构建操作更改为“Embedded Resource”,并填充自定义工具名称空间,我使用“GlobalStr”

我希望我的愚蠢将来能帮助别人