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 i.e. using in various MessageBoxes. 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. E.g. 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)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top