Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SQL server for multilanguage(hindi and english)

Author  Topic 

amitshar131
Starting Member

2 Posts

Posted - 2011-05-05 : 09:33:57
I want to use same table for hindi and english version of website. can i do it. or i need to store different tables to store english and hindi equivalents

example

itencode: 1
itemname: vegetable
subitemname: carrot

can i use same table to display 1, sabji ( in hindi), gajjar ( in hindi)

or i need to create a separate table and use
itemcode:1
itemname: sabji
subitemname: gajjar

and use this table while selecting hindi as language of my website

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2011-05-05 : 09:55:29
You could have 2 tables or different columns in the same table, or you could try for 1st normal form.

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2011-05-05 : 10:16:14
To avoid confusion: just create extra columns like
item_code INT , item_ename VARCHAR(100), item_hname NVARCHAR(200),subitem_ename VARCHAR(100),subitem_hname NVARCHAR(200)

--------------------------
http://connectsql.blogspot.com/
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2011-05-05 : 11:19:43
It might be simple to add extra columns, but I think you'll be much happier if you actually normalize your data as Don has suggested. I also think it is easier to code against a normalized solution as opposed to adding extra columns.
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2011-05-05 : 11:22:15
quote:
Originally posted by Lamprey

It might be simple to add extra columns, but I think you'll be much happier if you actually normalize your data as Don has suggested. I also think it is easier to code against a normalized solution as opposed to adding extra columns.



Especially if you later need to add another lanquage.



CODO ERGO SUM
Go to Top of Page

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2011-05-05 : 11:51:05
Amit,

Just use one single table with a labelkey.

you can have columns this way:

labelkey, englishtxt,hinditxt etc.

if you are using asp.net you can use hashtables(collections object) to populate the labels on the front end based on the choice of language.

Go to Top of Page

denis_the_thief
Aged Yak Warrior

596 Posts

Posted - 2011-05-05 : 14:03:12
quote:
Originally posted by Michael Valentine Jones

quote:
Originally posted by Lamprey

It might be simple to add extra columns, but I think you'll be much happier if you actually normalize your data as Don has suggested. I also think it is easier to code against a normalized solution as opposed to adding extra columns.



Especially if you later need to add another lanquage.



CODO ERGO SUM



I think I'd vote for that one. Something like:

ItemCodes
---------
ItemCode - PK - varchar
OnOrder - numeric
OnHand - numeric

ItemCodeDescriptions
--------------------
ItemCode
LangCode (Ex: English, Hindi, Punjabi)
Description


And you could write your function:
create function Translate(@ItemCode, @LangCode)
as
begin
declare @x varchar(250)
set @x = select Description from ItemCodeDescriptions
where ItemCode = @ItemCode and LangCode = @LangCode)
return @x
end



Go to Top of Page
   

- Advertisement -