locked
Why do people use resx? RRS feed

  • Question

  • User318703781 posted

    Hello,

    I'm new to Localization, my question is why do people do Language Localization using resx file which is one file per language, it could be a lot of resx file for worldwide.

    I mean why they aren't use xml or database or something else instead of creating one file per language.

    Any idea? What is the benefit of using resx?

    Thank you,

    rudy

    Sunday, June 13, 2010 9:18 AM

Answers

  • User-25924017 posted

    Its a choice you make, both are possible and has their own pros and cons.

    Language Localization using resx file which is one file per language, it could be a lot of resx file for worldwide

    First of all resource files are also xml files. one file per language is because then they are more maintainable and you can clearly identify them and update them, meta tags are created for resource strings.easy to use and create.

    I mean why they aren't use xml or database or something else instead of creating one file per language.

    You can use one xml file  or same way you can store them in database also and filter based on country, there is no problem in that approach but then you have customize the approach to find and  bind local resource string and for the tag which does not support <%= %> you have to use expression builder logic. resource can be extracted once and cached so you can avoid overhead.

    if you want to see live example of second approach i.e. database, download open source e commerce solution in csharp/asp.net from

    www. nopcommerce.com and look for class LocalizationManager and method LocalizationManager.GetLocaleResourceString(). it will explain you how to fetch resources from database cache them and use resource string for localization.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, June 13, 2010 11:12 AM

All replies

  • User-2139223635 posted

    Hi,,

         Yaah you can use localization with help of XML,which is useful..but for database it can make slow to program...to fetch the data from the database...

    Sunday, June 13, 2010 10:05 AM
  • User-25924017 posted

    Its a choice you make, both are possible and has their own pros and cons.

    Language Localization using resx file which is one file per language, it could be a lot of resx file for worldwide

    First of all resource files are also xml files. one file per language is because then they are more maintainable and you can clearly identify them and update them, meta tags are created for resource strings.easy to use and create.

    I mean why they aren't use xml or database or something else instead of creating one file per language.

    You can use one xml file  or same way you can store them in database also and filter based on country, there is no problem in that approach but then you have customize the approach to find and  bind local resource string and for the tag which does not support <%= %> you have to use expression builder logic. resource can be extracted once and cached so you can avoid overhead.

    if you want to see live example of second approach i.e. database, download open source e commerce solution in csharp/asp.net from

    www. nopcommerce.com and look for class LocalizationManager and method LocalizationManager.GetLocaleResourceString(). it will explain you how to fetch resources from database cache them and use resource string for localization.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, June 13, 2010 11:12 AM