Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do localization without resource file?

Articles from internet, they all do localization base on resource file xxxx.resx

Is there a way we can read resource from database?

like image 587
jojo Avatar asked Apr 27 '11 04:04

jojo


People also ask

What is resource localization?

Localization is the process of translating an application's resources into localized versions for each culture that the application will support.

What is RESX file?

resx file contains a standard set of header information that describes the format of the resource entries, and specifies the versioning information for the XML code that parses the data. These files contain all the strings, labels, captions, and titles for all text in the three IBM Cognos Office components.

What is the use of RESX file in C#?

Resources in . resx files. Unlike text files, which can only store string resources, XML resource (. resx) files can store strings, binary data such as images, icons, and audio clips, and programmatic objects.


2 Answers

ASP.NET resource provider model is extensible - so you can create your own resource provider and factories to get the resources from database. See below articles for more information:

Extending the ASP.NET 2.0 Resource-Provider Model

ASP.NET 2.0: Custom Resource Provider Using Sql Database

like image 89
VinayC Avatar answered Oct 05 '22 11:10

VinayC


yes you can store localize data in database rather than in *.resx file

following may be design of the table, this is just demo

CREATE TABLE [LocalizedData]
(
  [Identifier] varchar(50) NOT NULL,
  [Language] varchar(5) NOT NULL,
  [Title] nvarchar(50),
  [Description] nvarchar(200),   
  PRIMARY KEY ([Identifier], [Language])   
)

data something like this

 INSERT INTO [LocalizedData] ([Identifier], [Language], [Title], [Description])

      SELECT 'String1', 'en', 'first entry', 'This is my first entry'
like image 23
Pranay Rana Avatar answered Oct 05 '22 11:10

Pranay Rana