Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to localize MVC with database backed resources
    primarykey
    data
    text
    <p>I have read most of the literature Google and SO provides on this (correct me if I've missed something).</p> <p>What I am trying to do is to localize an MVC site using resources, I want the <a href="http://adamyan.blogspot.com/2010/02/aspnet-mvc-2-localization-complete.html" rel="noreferrer">compiletime safety of strongly typed resource files (ResX)</a> but the flexibility of the <a href="http://msdn.microsoft.com/en-us/library/aa905797.aspx" rel="noreferrer">ASP.NET 2.0 Resource-Provider Model</a>, or something similar to that. I dont mind doing some work but it seems all paths I've researched lead to a dead end.</p> <p>For displaying localized text in views I can <a href="http://www.eworldui.net/blog/post/2008/10/ASPNET-MVC-Simplified-Localization-via-ViewEngines.aspx" rel="noreferrer">hack together a helper to pull resources from HttpContext.Get(Global|Local)ResourceObject</a> but that gets me nowhere when it comes to <a href="http://ryanrivest.com/blog/archive/2010/01/15/reusable-validation-error-message-resource-strings-for-dataannotations.aspx" rel="noreferrer">model validation and scaffolding</a>, I suppose I could subclass the attributes and provide data but since it means pulling stuff from HttpContext I doubt that is available at the time the attributes are activated.</p> <p>Since the direction localization in MVC seems to be toward ResX files and away from the 2.0 Resource-Provider model I could try to inject myself in the classes generated by the ResXFileCodeGenerator <a href="http://www.codeproject.com/KB/dotnet/ResXFileCodeGeneratorEx.aspx" rel="noreferrer">with a custom ResXFileCodeGenerator</a> to provide my own ResourceProvider but that is terribly hackish involving custom Visual Studio Addins and codegeneration.</p> <p>So my question is basically, <strong>what's the story with flexible MVC localization</strong>?</p> <p>The referenced literature below:</p> <ul> <li><a href="http://adamyan.blogspot.com/2010/02/aspnet-mvc-2-localization-complete.html" rel="noreferrer">http://adamyan.blogspot.com/2010/02/aspnet-mvc-2-localization-complete.html</a></li> <li><a href="http://msdn.microsoft.com/en-us/library/aa905797.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/aa905797.aspx</a></li> <li><a href="http://www.eworldui.net/blog/post/2008/10/ASPNET-MVC-Simplified-Localization-via-ViewEngines.aspx" rel="noreferrer">http://www.eworldui.net/blog/post/2008/10/ASPNET-MVC-Simplified-Localization-via-ViewEngines.aspx</a></li> <li><a href="http://ryanrivest.com/blog/archive/2010/01/15/reusable-validation-error-message-resource-strings-for-dataannotations.aspx" rel="noreferrer">http://ryanrivest.com/blog/archive/2010/01/15/reusable-validation-error-message-resource-strings-for-dataannotations.aspx</a></li> <li><a href="http://www.codeproject.com/KB/dotnet/ResXFileCodeGeneratorEx.aspx" rel="noreferrer">http://www.codeproject.com/KB/dotnet/ResXFileCodeGeneratorEx.aspx</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload