Would you use Resource files (.resx) for page content? RRS feed

  • Question

  • User-1276841558 posted


    We have a website about 80 pages, and will be translating x4 languages. Are resoruce files used for page content? If so what is the best way to label the string values inside resource files. Page1-p1 (paragraph 1), Page1-p2 (paragraph 2).. etc? Or is it better to skip resource files in this case and create seperate pages for each langauge?


    Wednesday, October 30, 2013 9:44 AM

All replies

  • User398825048 posted

    Or you could store your language text in database and make it database driven, just an option.

    Wednesday, October 30, 2013 10:00 AM
  • User22205941 posted

    I too think this way. But my question is,

    • i have a database tables for culture(cultureid,culturename,...) and culturedata (pkid, cultureid, word,desc,culturevalue).
    • On page loading, i have to get all culturevalues from culturedata table and it stored into session values. Then, How to apply to label controls,textbox and so on.
    Thursday, December 5, 2013 4:34 AM
  • User398825048 posted

    Here are my suggestions -

    Suppose in your application if u have 2 webpages , page1 and page2 . Then in database you have to maintain all the control ids for each page, for eg. if page1 has controls with id txt1,lbl1 then insert these IDs in your database table along with its related page1. Create a C# class which finds all the controls on page which is getting loaded and in this class you can find the IDs and match with your database id and assign related text etc.  For eg. when page1 is getting loaded , then make a c# function in which u pass pagename and get all its related controls,text and then on page itself find the IDS using findcontrol of content page and then match related ids and assign whatever u want to assign..

    Hope it helps

    Thursday, December 5, 2013 5:00 AM
  • User22205941 posted

    Thanks... i got an idea from ur suggestions. Can u suggest this problem posted in this http://forums.asp.net/post/5576347.aspx 

    Thursday, December 5, 2013 5:08 AM
  • User398825048 posted

    Ok. let me look into it.. Also, please mark as answer if the post helped u.

    Thursday, December 5, 2013 5:31 AM
  • User1265204815 posted


    assuming you use the MVC Framework, I'd prefer using a custom ViewEngine (either WebForm or Razor, both possible) regarding my own currently localized sites.

    As some of the localizations use different teaser images or texts blow up the layout in some special cases, you can easily create adaptive views for any matter. Simply copy a view and attach the language info to the filename. The modified view engine tries to lookup the right view by currently selected locale and falls back to the default view if none is found.

    Sample: http://www.counity.at/blog/2012/asp-net-mvc3-localization-using-culture-dependent-views/

    Because you mentioned .resx for contents I'd recommend this to maximize the flexibility of static contents and just use .resx for buttons, labels and error messages.Nonetheless, it's quite difficult to manage the contents in the resource editor! ;)


    Tuesday, January 7, 2014 7:06 AM