Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Editing multiple resource file keys at once in visual studio

I have a c# application and I use visual studio 2013 to develop it. In trying to support i18n, resource files were made for every language:

resources.en.resx
resources.fr.resx
resources.es.resx
resources.de.resx and so on...

I want to change a KEY (not the value) of all the resource files to something more descriptive, for example change "Header.Text" to "MainExceptionTitle.Text" Currently, I see no way to do this but to change it manually in every file, which is very tedious.

I looked into the zeta resource editor project, but it also only allows the editing of values and not keys.

Is there a way to do this?

like image 811
user1884155 Avatar asked Oct 02 '22 18:10

user1884155


2 Answers

I have used Zeta too - This is what works for me:

  • Creating standalone projects in zeta, containing multiple languages
  • Editing both keys and the local(national) values

What does not work is changing the naming convension, so that it compiles in visual studio.

The naming of ..resx result in standalon resource files, that dont compile in visual studio in an ASP.NET project - The .design files do not compile.

When changing filenames to the following convension _.resx, Zeta cannont manage the files any more, but visual studio compiles the corresponding .Design files.

... mutual exclution??

like image 124
theodor.johannesen Avatar answered Oct 07 '22 19:10

theodor.johannesen


Since .resx files are XML, you can do a simple find & replace on them.

Use Visual Studio's Replace in Files tool to do this across all .resx files, like so:

Replace in Files dialog

like image 38
Ryan Kohn Avatar answered Oct 07 '22 19:10

Ryan Kohn