Editing multiple resource file files at the same time in visual studio

I have a C # application and I use visual studio 2013 to develop it. When trying to support i18n, resource files were created for each language:

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

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

I looked at the zeta resource editor project , but it also allows you to edit values, not keys.

Is there any way to do this?

+4
source share
3 answers

Since files .resxare XML, you can easily find and replace them.

Use the Visual Studio Replace in Files tool to do this in all files .resx, for example:

Replace in Files dialog

+1
source

I also used Zeta - this is what works for me:

  • Create standalone projects in zetas containing multiple languages
  • Editing both keys and local (national) values

What doesn't work is changing the naming content, so it compiles into visual studio.

Naming..resx results in standalone resource files that are not compiled into visual studio in an ASP.NET project. .Design files do not compile.

_.resx Zeta cannont , .Design.

...

+1

If you have Resharper installed, there is a very simple and safe way:

  • Open the corresponding constructor file (this is a C # file generated from resx, called <ResxFileName>.Designer.cs).
  • Go to the appropriate resource. Here you will find a static property for each key defined in the resx file.
  • Use the Resharper rename command (Ctrl-R, Ctrl-R on my machine).

Resharper opens the Rename Resource dialog, which correctly updates all resource keys.

+1
source

Source: https://habr.com/ru/post/1524050/


All Articles