I suggest you ...

Provide a ResourceManager abstraction mechanism

The existing System.Resources.ResourceManager is based on .resx files built into a fallback assembly with multiple satellite assemblies. This model works fine for some situations but it is inappropriate for others. It is relatively easy to create custom resource managers but it is not simple to get an application to use the custom resource manager instead of the ResourceManager.

What is needed is an abstraction from the 'default' ResourceManager - a mechanism by which I can tell my application to use *my* resource manager instead of System.Resources.ResourceManager.

The solution should not be tied to a specific user interface technology. For example the ASP.NET Web Forms Resource Provider mechanism is designed to work with ASP.NET (Web Forms) only. The solution should work with ASP.NET MVC, ASP.NET Web Forms, WPF, Silverlight, Windows Forms et al.

The solution should be suitable for use with (1) file based resource solutions (e.g. .resx, .xliff, .rc, .csv, .resw, .po), (2) database based resource solutions (e.g. ADO.NET, Entity Framework) and (3) service based resource solutions (e.g. WCF, Web API, Web Service, OData).

Ideally the existing Strongly Typed Resource Class (STRC) implementation would use this resource manager abstraction so that all of the existing code that is based on STRCs would be able to use the new solution.

182 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Guy Smith-FerrierGuy Smith-Ferrier shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    3 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • AnonymousAnonymous commented  ·   ·  Flag as inappropriate

        This is an overdue change. Microsoft should have provided such a mechanism for Framework 4.0.

      • Justin ChaseJustin Chase commented  ·   ·  Flag as inappropriate

        Can you give an example of when it's not appropriate? Also, as a work around you can fairly easily make your own single file generator and apply it to the .resx file and generate whatever code you want.

      • Rick StrahlRick Strahl commented  ·   ·  Flag as inappropriate

        Definitely agree. I work quite a bit with localization and this issue keeps coming up. I use a custom implementation that internally reads its configuration from a config file, but it's a hack at best. It's not an easy problem to solve generically though because resource usage may be mixed for different sources. Your app may use a Db manager, but third party assemblies may use embedded resources etc.

      Feedback and Knowledge Base