Reputation: 12053
It is possible to automatic create RESX files from CSHTML files in MVC3 or MVC4?
I would like to get resource file for all hardcored text in cshtml
I use Visual Studio 2012.
Upvotes: 1
Views: 2630
Reputation: 17944
You can generate resource files and localized views using custom templates in ASP.NET MVC.
The Add View dialog performs code generation that uses T4 templates behind the scenes. These templates can be modified to customize the generated code from these tools. You can also add custom templates.
Basically you have to copy the default templates to your project. This is the path:
[Visual Studio Install Directory]\Common7\IDE\ItemTemplates\
[CSharp | VisualBasic]\Web\MVC\CodeTemplates\
After you copy the templates, you can copy an existing one and change it to generate a .resx file that fits your needs. I wrote an article about it, you can find it here:
ASP.NET MVC Localization: Generate resource files and localized views using custom templates
Upvotes: 3