views:

115

answers:

6

Possible Duplicates:
Create a webpage with Multilanguage in PHP
PHP - how to translate a website into multiple languages?

I want to make a site which will have 3 languages - e.g. English, Arabic and Italian; the content sure will be different from one language to another.

Should I make different table for each language, e.g.:

en_articles
ar_articles
it_articles

each with the same article in different language,

or make one table articles like this:

article_id
article_en_title
article_ar_title
article_it_title

Please advise me.

A: 

If you work with ASP.Net , look at here

http://msdn.microsoft.com/en-us/library/c6zyy3s9.aspx

Judas Imam
no i work with php
moustafa
Look at these:http://www.bitrepository.com/php-how-to-add-multi-language-support-to-a-website.html------------------------------------http://devzone.zend.com/article/4469
Judas Imam
+1  A: 

I would suggest that you create only one table for the articles and put a column for the language. So, if you need to add a new language you don't need to change anything in your db

Ed
how if i want to add new one this want a change in the table to add new field with this lang if i used your method
moustafa
In your first method you'd have to create a new table and in your second method you'd have to create a new column. In the method I presented, when you add a new entry, put in the language column the value of the new language
Ed
+1  A: 

When you use PHP, you can see here: http://www.bitrepository.com/php-how-to-add-multi-language-support-to-a-website.html

+3  A: 

Create a table with a list of languages, and an articles table with a language column. That way, if you add a new language, you only need to add it to the languages table.

Example:

table `languages`:
| id | name    |
================
|  1 | English |
|  2 | Arabic  |
|  3 | Italian |

table `articles` (only relevant columns):
| language_id | title      | content                                  |
=======================================================================
|           1 | Some title | Some content in English                  |
|           3 | Ascia      | Dio mio! C'e' un' ascia nella mia testa! |
|           1 | Axe        | Oh my god! There's an axe in my head!    |

This way, you won't need to change the database schema when adding languages. As you can see, there is one articles table with one content column - significantly simpler to use than multiple article tables or multiple content columns.

Piskvor
+1  A: 

If you are very sure that you are going to work only with 3 languages, the best option is to use one table, with three columns, one for language:

article_id
article_en_title
article_ar_title
article_it_title

If eventually you need to add other language, only add other column.

If you think that you are going to add other languages, o you want to use the code for others web with differents languages, I think that the best solution is to use 3 tables, one for the languages, one for the articles and other table for relation them

table "languages"

language_iso
language_name

table "articles"

article_id
article_name (Internal name for the article)

table "articles_x_languages"

article_id
language_iso
article_title
article_text

I'm assuming that you are going to have each article in the three languages. Example:

Languages
language_iso | language_name
          en | English
          ar | Arabic
          it | Italian

Articles
article_id | article_name
         1 | Sample 1
         2 | Sample 2

Articles_x_languages
article_id | language_iso | article_title | article_text
         1 |           en | english title | Lorem ipsum ..
         1 |           ar |  arabic title | Lorem ipsum ..
         1 |           it | italian title | Lorem ipsum ..
         2 |           en | english title | Lorem ipsum ..
         2 |           ar |  arabic title | Lorem ipsum ..
         2 |           it | italian title | Lorem ipsum ..
Angel Aparicio
+1  A: 

If you are writing your website using java you might want to search about JAVA ResourceBundle, here is an example : http://java.sun.com/docs/books/tutorial/i18n/resbundle/propfile.html

If you are working with asp.NET you might want to check this: http://msdn.microsoft.com/en-us/library/ms228208.

Saher