C#: Resource file refactoring

clocalizationresxvisual-studio-2008

Does anyone know of a good tool for refactoring resources in a visual studio 2008 solution?

We have a number of resource files with translated text in an assembly used for localizing our application. But they have gotten a bit messy… I would like to rename some of the keys, and move some of them into other resource files. And I would like those changes be done in my code, and the translated versions of the resource files as well. Maybe a some analysis on what strings are missing in the translated versions, and what strings have been removed from the original as well…

Does anyone know of a good visual studio extension or ReSharper plugin that can help me with this? Right now it is kind of a pain, because I have to first rename the key in the base resource file, then in the localized versions. And then compile to get all the compile errors resulting from the key which now have a different name, and then go through and fix them all… very annoying =/

Best Answer

I just stumbled across this question which prompted me to blog about what I use for this problem here Moving and renaming resource keys in a .resx file.

I have two PowerShell scripts, one which renames a resource key and one which moves a resource key from one resource file to another.

Using these scripts I am able to rename a resource key:

.\RenameResource.ps1 oldKey newKey

And I can move a resource with key “keyName” from a file named “ResourceFile1.resx” to “ResourceFile2.resx”:

.\MoveResource.ps1 ResourceFile1 ResourceFile2 keyName