sean717
sean717

Reputation: 12663

Store localization texts in database or resource files?

Currently in my Asp.Net website I store localization texts in a table in the database. The table has three columns:

TextCode nvarchar(100),
CultureId int,
TextString nvarchar(MAX)

So every time when I need to get a localized text for a specific culture I just do a simple query.

The main advantage of this method is simple and also I can update the texts while my web app is running.

The obvious drawback is performance. I use resource files for localization in other desktop applications. The reason I chose database is I am under an impression that updating the resource file in asp.net will cause the web app to reload and thus I need to take the site offline when I update the resource file. Is assumption true? What's the "common" approach to store localized texts in Asp.Net?

Thanks

Upvotes: 1

Views: 639

Answers (1)

Prashant Lakhlani
Prashant Lakhlani

Reputation: 5806

Common approach is to use Global and Local resource files. If you want to use database consider using asp.net cache with sql cache dependency. In application start, load all your resource data from sql server and store it in cache, and create a utility class to return data from cache based on resource key.

Upvotes: 2

Related Questions