Products translation ?

11 years ago
Hi,

I ll would like to use nop for website with database products in 2 languages (French and English).

So i ll need to

- Add some table to database (like product_translation, category_translation ...)
- Edit lot of stored procedure like

ALTER PROCEDURE [dbo].[Nop_ProductLoadAll]
(
  @ShowHidden bit = 0
)
AS
BEGIN
  SET NOCOUNT ON
  SELECT *
  FROM [Nop_Product]    
  WHERE (Published = 1 or @ShowHidden = 1) and Deleted=0
  order by [Name]
END

To
ALTER PROCEDURE [dbo].[Nop_ProductLoadAll]
(
  @ShowHidden bit = 0,
  @Language CHAR(2)
)
AS
BEGIN
  SET NOCOUNT ON
  SELECT *
  FROM [Nop_Product]
        INNER JOIN Nop_Translation_Product ON Nop_Translation_Product.Fk_Nop_Product = Nop_Product.Id
  WHERE (Published = 1 or @ShowHidden = 1) and Deleted=0
        AND Nop_Translation_Product.Language = @Language
  order by [Name]
END


- I should edit C# to change stored procedure's call.

 public override DBProduct GetByProductID(int ProductID)
        {
            DBProduct product = null;
            if (ProductID == 0)
                return product;
            Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_ProductLoadByPrimaryKey");
            db.AddInParameter(dbCommand, "ProductID", DbType.Int32, ProductID);
            db.AddInParameter(dbCommand, "Langue", DbType.String, "FR");
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    product = GetProductFromReader(dataReader);
                }
            }
            return product;
        }


- And finally i ll complete administration panel to allow people to add products in severals languages


Do i take the good way to make nop fully multilingual support ?

If u have any suggestion to help me to make it easy to use and easy to include in nop for everybody
11 years ago
Yes. Your implementetion is quite good. Many sites implement localization this way
11 years ago
Ok thank, i have started to implement it.
I should have finish next week.
I ll send you SQL script (and database backup) and C# solution.
11 years ago
You're always welcome to contribute to nopCommerce
11 years ago
Dear Tely,
I need this feature can i take you great work ?



Thanks
11 years ago
Yes of course.

You can download my source code here : http://dl.free.fr/vH0pWjerr

You ll get :

- Complete solution
- Database backup (.bak)
- textfile with all alter procedure (you have no need for it, if you restore the database backup)
- ImportLangueNop.rar (small exe needed to translate nop front office in French)

Dont forget to edit the web.config (connectionstring)

I hope you will get it work fine, if you have any problem or question contact me

Mail : clemence[at]software-domain.com
Msn : feuille_du_chene[at]msn.com
11 years ago
Thanks a lot for you contribution. I've downloaded and reviewed your solution. Your implementation looks good. Perhaps we'll implement product/category localization the same way. Again thanks!
11 years ago
Thanks a lot for reply.

It works fine, you save my time. :))
11 years ago
Your welcome :)
11 years ago
Dear Tely
I just adopted your localization(products and categories).
And you just missed the thing is that product search (not working now).
Did you solve the problem?