Good day all,Good day NC team ,Good day Mr. Andrei ,
I'd love to share some info with you, a design that is best (from my view) for both full text search & language support .
then I have another design concerning Translators staff based on it as follows:
1-An Initiator is the level 1 Translator who will view only what he is permeted to view(latter inStatusID it will be explaned).
2-Validator who will see the translation & verify it before it can be shown to visitors of the web site.
now consider a table called cultures like this :
CREATE TABLE [Culture](
[CultureID] INT NOT NULL,
[Name] NVARCHAR (20) NOT NULL UNIQUE,
[Sorting] SMALLINT NOT NULL,
[Active] BIT NOT NULL DEFAULT 1,
CONSTRAINT [PK_CultureID] PRIMARY KEY CLUSTERED ([CultureID] ASC));
CultureID int but not auto increment brcause we will enter its LCD code i.e1033 for en-US,1036 for fr-Fr ,You can get this list from http://msdn.microsoft.com/en-us/library/0h88fahh(VS.85).aspx
Now,let's take an entity as Product table to be an example to localize & use catalog search i.e FTS,then we can implement the same technique for all other entities
her is our Product table:
for simplicity,I need ProductID ,name,Description,Price ,but of course you can add any other proprties you need.
As you can see,We'll use English as our default language .So, We'll create Product table to handel English Text,
& ProductCulture to handele any other language.
CREATE TABLE [Product](
[ProductID] INT IDENTITY(1,1) NOT NULL,
[Name] VARCHAR(50) NOT NULL UNIQUE,
[Description] VARCHAR(MAX) NOT NULL,
[Price] MONEY NOT NULL
CONSTRAINT [PK_Product] PRIMARY KEY CLUSTERED ([ProductID] ASC))
Now,let's create full text search:
CREATE FULLTEXT CATALOG MyFullTextCatalog
WITH ACCENT_SENSITIVITY = OFF
AUTHORIZATION dbo; --Owner
CREATE FULLTEXT INDEX
[Name] LANGUAGE English,
[Description] LANGUAGE English
KEY INDEX [PK_Product]--PK
ALTER FULLTEXT INDEX
ON [Product] ENABLE;
Now,Create ProductCulture & Please pay attention as this is the most important part!!!!
CREATE TABLE [ProductCulture](
[ProductCultureID] INT IDENTITY(1,1) NOT NULL,
[ProductID] INT NOT NULL,
[CultureID] INT NOT NULL,
[Name] NVARCHAR(50) NOT NULL,--[Name] default for NON en-us
[Description] NVARCHAR(1000) NOT NULL,--[Description] default for NON en-us
CONSTRAINT [PK_ProductCulture] PRIMARY KEY CLUSTERED ([ProductCultureID] ASC),
CONSTRAINT [AK_ProductID_CultureID] UNIQUE NONCLUSTERED([ProductID],[CultureID]))
ALTER TABLE [ProductCulture] WITH CHECK ADD CONSTRAINT FK_ProductCulture_Culture
ALTER TABLE [ProductCulture] WITH CHECK ADD CONSTRAINT FK_ProductCulture_Product
when a new product is created,its PriductID is inserted in the database (can be read by @@identity).
Now for French,In ProductCulture
ProductID in ProductCulture is FK to ProductID in Product ,So We make sure that no product will be translated except
if it exidt in Product table.
Again,CultureID in ProductCulture is FK to CultureID in Culture.
Now,For CultureID 1036 for French can be inserted in ProductCulture if it exist in Cultures
An alternate key is used to maintain integrety(ProductID,CultureID) i.e ProductID =1 will be translated once & only once to any language.
So, This is fine for language support, but what about FTS that cann't accept PK with multicolums?
Here comes ProductCultureID key !
This is the key that will be consumed by the FTS feature!
If you like this design, you can follow me to the Translators section !!!!!!
we will create log file for Product to track products created by Admins!
but what about the translators????
We need to know the status of the product
Now let's create the StatusID table
CREATE TABLE [Status](
[StatusID] INT NOT NULL,
[Name] VARCHAR (20) NOT NULL,
CONSTRAINT [PK_Status] PRIMARY KEY CLUSTERED ([StatusID] ASC));
let's say w'll have:
StatusId 1 to refer to Pending
StatusId 2 to refer to Intialized
StatusId 3 to refer to Rejected
StatusId 4 to refer to Accepted.
Now lets create the log table for ProductCulture
--- PRODUCT log
CREATE TABLE [ProductCultureLog](
[EventID] INT IDENTITY(1,1) NOT NULL,
[ProductCultureID] INT NOT NULL,
[StatusID] INT NOT NULL,
[UserID] UNIQUEIDENTIFIER NOT NULL,
[AddDate] SMALLDATETIME NOT NULL DEFAULT GETDATE(),
CONSTRAINT PK_ProductCultureLog PRIMARY KEY CLUSTERED ([EventID] ASC))
ALTER TABLE [ProductCultureLog] WITH CHECK ADD CONSTRAINT FK_ProductCultureLog_Product
REFERENCES [Product] ([ProductID])
ALTER TABLE [ProductCultureLog] WITH CHECK ADD CONSTRAINT FK_ProductCultureLog_Status
REFERENCES [Status] ([StatusID])
ALTER TABLE [ProductCultureLog] WITH CHECK ADD CONSTRAINT FK_ProductCultureLog_UsersInAccounts
REFERENCES [UsersInAccounts] ([UserID])
now we have this table so.what's up??
1-Initiator will see only what he can i.e
Pending after adminstrator insert new product.
Rejected if the verifier rejected such translation for any mistackes.
2-Verifier will see Intialized indecating that primary translation is over ,so He must Accept to be shown to visitors,
or,rejected to appear back to Initiator to make any neccesary actions.
each of the precceding step is loged as a row in ProductCultureLog table.
I hope You enjoy.
Dear Mr. Andrei,
I'll be waiting for your evaluation to my precceding design as your openion is very valuable to me.
Thank you all.