This project is read-only.

Store resources in database

Jan 24, 2011 at 10:01 PM


I would like to know is it a good or a bad idea to store resources - localization strings - in a database?

I have a project, which is a two months old S#arp Architecture's v1.9 - based web portal. I store resources in a database.

I could have an empty database and if I call for a resources by name in my html the requested resource string will be dynamically created for all installed languages.

If user adds a new language via admin panel, all existing resources will be copied for this language. So administrator could change all necessary labels via sweet UI. 


I want to move my project to Orchad because customer wants more features, which I will be implementing much longer than just use Orchad and migrate my existing business logic.

I know, there are resources editors for Orchad as modules, but just curious - is it worth adding, as an option, storing resource strings in a database?

Will this hit performance? It should not, because NHibernate caching (it has 2 levels of caching!) and my old web site's performance is really great! :) And we have 4 languages with ~ 1000 strings each.

Thank you,


Jan 24, 2011 at 10:18 PM

With the right caching, it should be fine if you're ok trading perf for memory usage, but the question I want to ask is why would you want to do that in the first place?

Jan 24, 2011 at 10:35 PM

Because for customer "total localization" is on a first place :) 

We really localized everything: products categories names, products types names, products properties names, lists (or they also could be called as dictionaries), all strings in a web site.

I will raise more topics on these discussion and will create not one module for orchad, because I don't see a few types of Fields, don't see something like "employees relationship and companies relationships management", don't see a function to add additional data to a user like a full address with hierarchies of Country/City/CityArea/Street/building/appartment or with another business objects like Companies as a part of a User object, etc etc etc.

I was so angry I saw this project too late! :) But better later than never.

if I write non-existing resource string call in my html, will that resource be created for all installed language? - does this work in Orchad?

if no, I would like to implement this! :) 


Jan 24, 2011 at 11:28 PM

What I meant was why do you want those strings in the database?

Currently in Orchard, we have the localization of static strings (strings defined in code and template files) that relies on po files, and we have localization of contents which relies on the database.

For static resource strings, you just write T("My new string to localize") in your code and the system will look for translations of that in the current culture. If it doesn't find it, it will just display the string as is.

Does that answer your question?

You can learn more about Orchard localization here: