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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can generate resource files and localized views using custom templates in ASP.NET MVC.
Overriding ASP.NET MVC Custom Templates
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