We have a large localized ASP.NET MVC 4 site and we are struggling to manage the resource keys. What we have at the moment is a series of partial static classes containing constant values such as the following:
public static partial class Resources { public static class News { public static class Shared { public const string Title = "News_Shared_Title"; } } } This allows us for example to call the following:
<%: Html.Resource(Resources.News.Shared.Title) %> On a view which passes the key "News_Shared_Title" to our database resource implementation.
The problem with this is it slows down development having to stop and manage the static classes whereas it would be much faster to for example just type:
<%: Html.Resource("News_Shared_Title") %> The problem with this approach is that it is harder to manage, possible typos and we also lose the ability to have an application that uses reflection to get all the key values from the static resource classes and see which are missing from the database.
My question is how do other people manage their resource keys and is there a better approach? If we went with strings on the views/controllers/etc. how would we get all the keys within an application and see which are missing from the database?