开发者

.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,

  1. Create all "Resources/Purpose.lang-COUNTRY.resx" as needed

  2. Create a singleton that loads currentculture and hook corresponding resx file.
  3. 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜