Search code examples
asp.netvisual-studioasp.net-mvc-5embedded-resourcemultilingual

VisualStudio: Should one use a separate Resource-Files-Project for Resource-Files?


We are starting to develop a new asp.net mvc 5 application that should be multilingual.

I found a very nice tutorial how to get this working. The only thing I wonder about this tutorial is, that the author suggests to create a separate project inside the solution for the resources.

Now my question: Is this recommended?


Solution

  • I usually create a folder called Resources inside my MVC project. Although if you wish to reference your resources from other projects, you may wish to create them inside a separate project.

    I then sub-folder based on my controller names and change the 'Custom Tool' property to 'PublicResXFileCodeGenerator'.

    When I use the resource strings in my Views, it looks like:

    <title>@Resources.Home.Index.PageTitle</title>
    

    Personally, I prefer to use a folder rather than a project, as this forces me to not generate UI strings in my application layers and forces me to find better ways to solve problems where I might end up generating strings in my business logic that might end up in the UI.