How do I ensure full coverage of a localization resource file in Visual Studio?

lets say I have created a Windows Form application, written in C# (or VB), using Visual Studio (2012).

My application is targeted at an English speaking audience as well as at an German speaking.

Therefore, I've created two resource files (.resx) which contain the strings I am ie using in various MessageBox es. Something like: MessageBox.Show(rm.GetString("file_not_found"), MessageBoxButtons.OK, MessageBoxIcon.Error);

How do I make sure that the string resource "file_not_found" is contained in my .resx files? How do I ensure a full coverage?

Visual Studio does not offer a check at compile time that makes sure that my resource strings are all contained in the resource files!

I do not want my application to crash when it is unable to find a resource string at runtime...

Edit: I am accessing my resources using: internal static ResourceManager rm = new ResourceManager("myNamespace.Resources.lang", System.Reflection.Assembly.GetExecutingAssembly());

And I have manually created two (non auto generated) resources files, lang.de_DE.resx and lang.en_GB.resx ...


I haven't come across that way of accessing resource strings before. I'm always able to access resources in a strongly-typed way. Eg assuming I've got a resources file called Resource1.resx, and I've added a string resource named "file_not_found" then I can access it like so:-

MessageBox.Show(Resource1.file_not_found)
链接地址: http://www.djcxy.com/p/66644.html

上一篇: 不可访问,内部,资源文件?

下一篇: 如何确保在Visual Studio中完全覆盖本地化资源文件?