How can I make multi-language website
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_articleseach with the same article in different language, or make one table articles like this: article_id article_en_title article_ar_title article_it_titlePlease advise me.
3 Answers
Xenical 120 Mg <a href=http://tadalaffbuy.com>canadian pharmacy cialis</a> Cephalexin Taste Acquistare Kamagra Belgio
Posted: Ellgaibra 0 of 0 people found this answer helpful. Did you? Yes No
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. Posted: Go 1 of 1 people found this answer helpful. Did you? Yes No
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_titleIf 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_nametable "articles" article_id article_name (Internal name for the article)table "articles_x_languages" article_id language_iso article_title article_textI'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 .. Posted: MacOS 1 of 1 people found this answer helpful. Did you? Yes No |
© Advanced Web Core. All rights reserved