.resx file (culture-specific) with singleton pattern?
Honestly this is first time into resx files for me. I try to investigate what bad and good pract开发者_JS百科ice and finds that there exist as much ideas as lines for someone soon to translate.
As whole I got into this idea,
- Create all "Resources/Purpose.lang-COUNTRY.resx" as needed
- Create a singleton that loads currentculture and hook corresponding resx file.
Whenever needed, use SingletonName.GetString("StringVariable");
- How about using Singleton here?
- Yes/no what's better practice?
I'm also a little confused of how to find correct name to refer the embedded resx.
ResourceManager rm =
new ResourceManager("SomeLang.en-US", Assembly.GetExecutingAssembly());
It searches for a .resource (the files are named resx) and I can't find the resource specification in dll through reflector..
I found a fairly straight forward approach for internationalization in ASP.NET MVC3 that I thought may give you a different angle to consider / compare your current approach with.
http://afana.me/post/aspnet-mvc-internationalization.aspx
精彩评论