Reputation: 121
I am creating an ASP.NET MVC 3 application. In this application I need to fetch localized strings from a database. So I am writing a custom resource provider using the technique described in this article http://msdn2.microsoft.com/en-us/library/aa905797.aspx.
Question 1: I would like to know how to specify the localized strings in the views. If the localized strings are from a resource file, they would be specified as @{Namespace}.{ResourceFileName}.{ResourceKey} as mentioned in http://afana.me/post/aspnet-mvc-internationalization-part-2.aspx. How would the localized strings be specified in my case where the strings are in a database.
Question 2: Also I need to create custom resource provider factory class derived from ResourceProviderFactory. Here i have to override the CreateLocalResourceProvider method which takes one parameter "virtualpath". I would like to know to what value would be passed to the “virtualpath” parameter when the CreateLocalResourceProvider is called. Is there a way to control through code the value passed to the “virtualpath” parameter.
Upvotes: 2
Views: 2430
Reputation: 286
once i decided it like below (for aspx view engine)
<a href="<%: Url.Action("Create")%>">
<asp:Literal runat="server" Text="<%$ Resources:UI.MyType, CreateNew %>" />
</a>
maybe it help
Upvotes: 1