Dear All. I have begun working on translation module for ver. 1.4.
This is how I intend to do it for products
TABLE:
USE [nopCommerce]
GO
/****** Object: Table [dbo].[Nop_ProductContent] Script Date: 01/13/2010 09:56:48 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Nop_ProductContent](
[ProductId] [int] NOT NULL,
[LanguageId] [int] NOT NULL,
[Name] [nvarchar](400) NOT NULL,
[ShortDescription] [ntext] NOT NULL,
[FullDescription] [ntext] NOT NULL,
[MetaTitle] [nvarchar](400) NOT NULL,
[MetaKeywords] [nvarchar](400) NOT NULL,
[MetaDescription] [nvarchar](4000) NOT NULL,
[SEName] [nvarchar](100) NOT NULL,
[CreatedOn] [datetime] NOT NULL CONSTRAINT [DF_Nop_ProductContent_CreatedOn] DEFAULT (getdate()),
[UpdatedOn] [datetime] NOT NULL CONSTRAINT [DF_Nop_ProductContent_UpdatedOn] DEFAULT (getdate()),
CONSTRAINT [PK_Nop_ProductContent] PRIMARY KEY CLUSTERED
(
[ProductId] ASC,
[LanguageId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[Nop_ProductContent] WITH CHECK ADD CONSTRAINT [FK_Nop_ProductContent_Nop_Language] FOREIGN KEY([LanguageId])
REFERENCES [dbo].[Nop_Language] ([LanguageId])
GO
ALTER TABLE [dbo].[Nop_ProductContent] CHECK CONSTRAINT [FK_Nop_ProductContent_Nop_Language]
GO
ALTER TABLE [dbo].[Nop_ProductContent] WITH CHECK ADD CONSTRAINT [FK_Nop_ProductContent_Nop_Product] FOREIGN KEY([ProductId])
REFERENCES [dbo].[Nop_Product] ([ProductId])
GO
ALTER TABLE [dbo].[Nop_ProductContent] CHECK CONSTRAINT [FK_Nop_ProductContent_Nop_Product]
SPROC:
ALTER PROCEDURE [dbo].[Nop_ProductLoadByPrimaryKey]
(
@ProductID int,
@LanguageID int = 0,
@IsAdmin bit = 0
)
AS
BEGIN
-- UPDATE FOR MULTI LANGUAGE.
-- Will select the requested language
SET NOCOUNT ON
SELECT
np.ProductId,
[Name] =
CASE
WHEN NOT pc.Name IS NULL THEN pc.Name -- If a language translation exists, then make this default
ELSE np.Name -- no language exists? then take from nop_Product
END,
ShortDescription =
CASE
WHEN NOT pc.ShortDescription IS NULL THEN pc.ShortDescription -- If a language translation exists, then make this default
ELSE np.ShortDescription -- no language exists? then take from nop_Product
END,
FullDescription =
CASE
WHEN NOT pc.FullDescription IS NULL THEN pc.FullDescription -- If a language translation exists, then make this default
ELSE np.FullDescription -- no language exists? then take from nop_Product
END,
np.AdminComment,
np.ProductTypeID, np.TemplateID, np.ShowOnHomePage,
MetaKeywords =
CASE
WHEN NOT pc.MetaKeywords IS NULL THEN pc.MetaKeywords -- If a language translation exists, then make this default
ELSE np.MetaKeywords -- no language exists? then take from nop_Product
END,
MetaDescription =
CASE
WHEN NOT pc.MetaDescription IS NULL THEN pc.MetaDescription -- If a language translation exists, then make this default
ELSE np.MetaDescription -- no language exists? then take from nop_Product
END,
MetaTitle =
CASE
WHEN NOT pc.MetaTitle IS NULL THEN pc.MetaTitle -- If a language translation exists, then make this default
ELSE np.MetaTitle -- no language exists? then take from nop_Product
END,
SEName =
CASE
WHEN NOT pc.SEName IS NULL THEN pc.SEName -- If a language translation exists, then make this default
ELSE np.SEName -- no language exists? then take from nop_Product
END,
np.AllowCustomerReviews, np.AllowCustomerRatings, np.RatingSum,
np.TotalRatingVotes, np.Published, np.Deleted, np.CreatedOn, np.UpdatedOn,
np.Name as StandardName,
np.ShortDescription as StandardShortDescription,
np.FullDescription as StandardFullDescription,
np.MetaKeywords as StandardMetaKeywords,
np.MetaDescription as StandardMetaDescription,
np.SEName as StandardSEName
FROM [Nop_Product] as np
LEFT OUTER JOIN Nop_ProductContent pc
ON np.ProductId = pc.ProductId AND pc.LanguageId = @LanguageID
WHERE
(np.ProductID = @ProductID)
END