Database with mutli language data
I have regiteration form in two languages arabic and english how can i insert regester date in enlish or arabic in database ..... does I need two tables or can it be done in the same table ?? and how it can be done ???
VulpesPosted Apr 18, 2014, 6:22 AM
http://stackoverflow.com/questions/181697/multiple-languages-in-one-database-sql-server-2005
So I think the best thing you can do is to simply try it using unicode strings (nvarchar) for those columns which could be in either language.
You could record whether the record is stored in English or Arabic by adding this column to the database table:
IsEnglish bit NOT NULL
You could then pass 1 to this column if it's an English record or 0 if it's an Arabic record and filter on it if you need to separate the two sets of records for any reason.
As mentioned in my first post, I'd store the registration date for all records in the English format converting between that and Hijri as needed.
If you're using SQL Server, I'd also read through the following document which discusses in detail its Arabic language support and related issues. Even though it relates to Sql Server 2005, the information it contains should still hold good for later versions:
http://technet.microsoft.com/en-US/library/cc295829(v=SQL.90).aspx
alaaPosted Apr 17, 2014, 12:07 AM
VulpesPosted Apr 16, 2014, 3:48 PM
However, as long as you use unicode character types (nvarchar, nchar or ntext) you could still store English and Arabic names and addresses in the same table, though you'd need to add a 'bit' column to indicate whether the record is stored in English or not.
That would give you some of the benefits of having a single table though you'd obviously need to deal with the English and Arabic records separately if you were doing any ordering or manipulation of the string columns.
Although it's not ideal, it might be better than having two separate tables as you couldn't really join these in any meaningful way.
alaaPosted Apr 16, 2014, 3:08 PM
VulpesPosted Apr 16, 2014, 2:57 PM
If you're using .NET to write to or read from the database, then you can easily convert between Hijri and Gregorian dates using classes in the System.Globalization namespace.
The following is largely based on an example I found on MSDN:
The output is:
If you're not using .NET, then the chances are that the SQL dialect has a Hijri conversion built in. For example if you're using SQL Server, the Convert function has styles of 130 and 131 to deal with Hijri:
http://msdn.microsoft.com/en-us/library/ms187928.aspx