var resources = new ResourceLoader(); var localizedString = resources.GetString("SomeResourceName");
This of course can easily lead to a lot of errors. In my case I got a little to eager while refactoring and forgot to notice that I was also changing hard coded strings. This broke the code quite a lot. Because of this frustration I decided to implement my own custom tool since Microsoft didn't provide one
The project is open source and is available at CodePlex. Here's a preview of the description which I took directly from my CodePlex project site.
Project Description
A Visual Studio 2012 Custom Tool for generating a strongly typed helper class for accessing localized resources from a .ResW file.
Features
- C# code generator
- VB.NET code generator
Visual Studio 2012 Custom Tool (C#)
Visual Studio 2012 Custom Tool (VB)
Resource File Contents
C# Usage
Visual Basic Usage
Generated C# Code
Generated Visual Basic Code
A Visual Studio 2012 Custom Tool for generating a strongly typed helper class for accessing localized resources from a .ResW file.
Features
- C# code generator
- VB.NET code generator
Visual Studio 2012 Custom Tool (C#)
Visual Studio 2012 Custom Tool (VB)
Resource File Contents
C# Usage
Visual Basic Usage
Generated C# Code
Generated Visual Basic Code