| Author |
multi-language website |
mistake25
Member
Posts: 30
Location:
Joined: 08.01.07 Rank: God |
|
hi,
i want ask, what is the best opinion to make multilanguage site, sotre translations in array, or in database? or something else, thanks
 |
|
| Author |
RE: multi-language website |
Coder Disaster
Member
Posts: 92
Location: BIOS
Joined: 01.09.08 Rank: Newbie Warn Level: 20
|
|
I have done it like so
eng.inc.php
$word_1 = "English word";
otherlang.inc.php
$word_1 = "Other lang word";
main.php
session_start();
if(isset($_GET['lang']))
{
if($_GET['lang'] == 1)
{
include eng.inc.php;
}
}
echo $word_1;
That should start u off in the right direction .
Btw this is just an example, it will need security etc.
Im a coding disaster
Edited by Coder Disaster on 01-09-08 19:16 |
|
| Author |
RE: multi-language website |
Zephyr_Pure
Member

Posts: 2402
Location:
Joined: 15.09.06 Rank: God |
|
http://alma.ch/blogs/bahut/2006/03/simple-multi-language-web-site.html
Second result when Googling "multi-language website".
I still check PMs from time to time.


Our responses were moronic, why shouldn't he follow suit? - Futility |
|
| Author |
RE: multi-language website |
mistake25
Member
Posts: 30
Location:
Joined: 08.01.07 Rank: God |
|
2 Zephyr_Pure: yes i know i can use google, but i want to know yours opinion
 |
|
| Author |
RE: multi-language website |
Coder Disaster
Member
Posts: 92
Location: BIOS
Joined: 01.09.08 Rank: Newbie Warn Level: 20
|
|
I hate them pre-made codes, i always like to write my own.

Im a coding disaster |
|
| Author |
RE: multi-language website |
Zephyr_Pure
Member

Posts: 2402
Location:
Joined: 15.09.06 Rank: God |
|
|
mistake25 wrote:
2 Zephyr_Pure: yes i know i can use google, but i want to know yours opinion
Okay... my opinion is that you should use a db with tables for your different content areas and translations for each language, then dynamically populate your pages based upon the language that your visitor chose (and had set through a session variable by your code, most likely).
I still check PMs from time to time.


Our responses were moronic, why shouldn't he follow suit? - Futility |
|
| Author |
RE: multi-language website |
Coder Disaster
Member
Posts: 92
Location: BIOS
Joined: 01.09.08 Rank: Newbie Warn Level: 20
|
|
I dnt think that a database is needed for this, just either flat file system , or an .inc file should do, but depends on how much content you want to change.
Im a coding disaster |
|
| Author |
RE: multi-language website |
Zephyr_Pure
Member

Posts: 2402
Location:
Joined: 15.09.06 Rank: God |
|
|
Coder Disaster wrote:
I dnt think that a database is needed for this, just either flat file system , or an .inc file should do, but depends on how much content you want to change.
It's not needed for that, no... nor did I state it was. I gave my suggestion. Is it necessary to have multiple directories and files holding the same content in different languages? No... but, that doesn't make your suggestion any less valid, either.
I still check PMs from time to time.


Our responses were moronic, why shouldn't he follow suit? - Futility |
|
| Author |
RE: multi-language website |
Coder Disaster
Member
Posts: 92
Location: BIOS
Joined: 01.09.08 Rank: Newbie Warn Level: 20
|
|
I wasnt having a go at you, i assumed you meant use a database to store the translations.
BUt it all depends on how much content he wants to change.
Im a coding disaster |
|
| Author |
RE: multi-language website |
Zephyr_Pure
Member

Posts: 2402
Location:
Joined: 15.09.06 Rank: God |
|
|
Coder Disaster wrote:
I wasnt having a go at you, i assumed you meant use a database to store the translations.
BUt it all depends on how much content he wants to change.
I did. It depends on how easily expandable he wants it to be, not on how much content he wants to change.
The purpose of a dynamic website driven by database content and static includes is to not have to modify the source every time you want to add a change. For instance, if he decides he wants to add Hebrew to the site at some point, he shouldn't have to manually add it to the included select object listing the languages and to the conditionals in his code that are populating the correct content. Instead, the site should pull all of the available languages from the db when the main page is loaded (to populate the select options), then just run the same queries to pull content based upon the value of a session variable... as compared to the language entry in the db. He could easily add 5, 10, or 100 languages this way.
So, you have a point... and there are different ideal solutions based upon the scope of his idea.
I still check PMs from time to time.


Our responses were moronic, why shouldn't he follow suit? - Futility |
|
| Author |
RE: multi-language website |
Coder Disaster
Member
Posts: 92
Location: BIOS
Joined: 01.09.08 Rank: Newbie Warn Level: 20
|
|
Yer i agree with that ^^.
If you want i can help you design the DB structure, and create the code.
Im a coding disaster |
|