如何摆脱 MissingManifestResourceException
我花了将近 8 个小时来寻找如何摆脱这个奇怪的异常的答案。我有一个 C# 应用程序,需要本地化为多种语言。我对资源文件使用父级语言名称,即对于英语,我的 resX 文件是 lang.en.resx
,对于捷克语,它是 lang.cs.resx
。所以我不关心 en-US、en-GB 等语言变体。 我的应用程序的默认命名空间是 GSMMaster,我的应用程序是 GSMMaster。我的资源管理器是这样构造的:
if (!_autoDetectLanguage)
_currentCulture = CultureInfo.CreateSpecificCulture(_selectedLanguage);
else
_currentCulture = CultureInfo.GetCultureInfo(CultureInfo.CurrentCulture.Name);
_rManager = new ResourceManager("GSMMaster.lang", Assembly.GetExecutingAssembly());
我有两个 resX 文件:捷克语和英语。捷克语工作得很好,但英语会抛出这个异常。 我已经尝试了到目前为止发现的所有选项,但没有运气。有人对这种行为有经验吗?一种语言资源有效,第二种则无效?或者,是否有一些关于如何创建这些文件的常规方法?
多谢。
I've spent almost 8 hours by searching for an answer on how to get rid of that freakin' exception. I have an C# application which needs to be localized to several languages. I'm using parent-level language names for resource files i.e. for english language, my resX file is lang.en.resx
, for czech it is lang.cs.resx
. So I'm no bothering about language variants like en-US, en-GB.
Default namespace for my app is GSMMaster, my app is GSMMaster. My resource manager is constructed like this :
if (!_autoDetectLanguage)
_currentCulture = CultureInfo.CreateSpecificCulture(_selectedLanguage);
else
_currentCulture = CultureInfo.GetCultureInfo(CultureInfo.CurrentCulture.Name);
_rManager = new ResourceManager("GSMMaster.lang", Assembly.GetExecutingAssembly());
I have two resX files : czech, and english. Czech works just fine, but english throws that exception.
I've tried all options which I've found with no luck so far. Does anybody have some experience with that behavior ? One language resource works and second not ? Or, is there some conventional approach on how to create those files ?
Thanks a lot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论