资源(RESX)文件搞砸了 [英] Resource (RESX) files messed up

查看:255
本文介绍了资源(RESX)文件搞砸了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为Localize.resx的资源文件,其中包含英文字符串。我复制并粘贴它在同一文件夹(App_GlobalResources文件)里,创建VS副本,我改名为副本Localize.sl.resx和原为Localize.en.resx。现在,一切都在codebehind文件(Localize.en.designer.cs)已经一去不复返了。删除设计师文件并选择运行自定义工具生成一个新的,但完全空白的设计文件。

I had a resource file named Localize.resx, which contains English strings. I copied and pasted it inside the same folder(App_GlobalResources), VS created a copy, I renamed the copy to Localize.sl.resx and the original to Localize.en.resx. Now everything in codebehind files (Localize.en.designer.cs) is gone. Deleting the designer file and selecting Run Custom Tool generates a new but completely blank designer file.

我还有我的两个RESX的所有字符串,但设计师的文件都没有了(空),因此应用程序不建。

I still have all my strings in both resx's but the designer files are gone (empty) so the application does not build.

有什么建议?

这是内部的VS 2010的ASP.NET MVC的解决方案。

This is inside Vs 2010 with ASP.NET MVC solution.

推荐答案

这是什么 ASP.NET文档说,大约资源文件。

This is what ASP.NET documentation says about resources files.

它不会对实时生成codebehind设计文件具体谈,但如果你仔细阅读黑体字,它本质上是说,你所需要的基本文件没有指定语言,因为,这是有道理的,只有这个文件将自动生成包含code。

It does not talk specifically about codebehind designer files generated on the fly but if you read the bolded text carefully, it is essentially saying that you need the base file without language specified and, given that, it makes sense that only this file will include autogenerated code.

当你创建资源文件,您可以通过创建基本的.resx文件开始。对于要支持的每种语言,创建具有相同的文件名的新文件,但在名称,包括。语言或语言和文化(文化名)有关区域性名称的列表,请参阅CultureInfo类。例如,您可以创建以下文件:

"When you create resource files, you start by creating a base .resx file. For each language that you want to support, create a new file that has the same file name. But in the name, include the language or the language and culture (culture name). For a list of culture names, see the CultureInfo class. For example, you might create the following files:

•WebResources.resx

•WebResources.resx

的碱资源文件。这是默认(后备)资源文件。

The base resource file. This is the default (fallback) resource file.

•WebResources.es.resx

•WebResources.es.resx

有关西班牙的资源文件。

A resource file for Spanish.

•WebResources.es-mx.resx

•WebResources.es-mx.resx

西班牙语(墨西哥)明确。一个资源文件

A resource file for Spanish (Mexico) specifically.

•WebResources.de.resx

•WebResources.de.resx

德语资源文件。

其实,我以前从来没有注意到这一点,但是当我去检查我的老项目中,我看到他们都有基本文件,然后特定语言的。所以我就改正它按照惯例和现在的工作。

I actually have never noticed this before but when I went to check my old projects, I saw they all have the base file and then language specific ones. So I just corrected it to follow that convention and it works now.

这篇关于资源(RESX)文件搞砸了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆