Forum Moderators: coopster

Message Too Old, No Replies

Different languages

2 or more languages on one site.

         

cdmn

2:14 pm on Aug 15, 2007 (gmt 0)

10+ Year Member



Hi there,

what is the best way to implement different language on one site?
Lets say i need to switch between EN and GE languages.

Some link, or example, suggestion... smth, would be nice :-)

Thanks in advance.

dreamcatcher

2:23 pm on Aug 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A cookie [us2.php.net] would be your best bet. If no cookie is set, load default.

dc

cdmn

3:18 pm on Aug 15, 2007 (gmt 0)

10+ Year Member



I understand this.

The question is really about the mechanism it self.
What is the best way, to get the language words from DB, or XML file?

Some url to article would be great!

LifeinAsia

3:34 pm on Aug 15, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



It all depends- we use both on our sites. You need to do your own testing to see which is faster/easier to maintain.

For our own testing, I fould flat files to be faster in most cases. However, depending on your DB, you can used cached queries for better performance.

cdmn

3:58 pm on Aug 15, 2007 (gmt 0)

10+ Year Member



So in your opinion, you would prefer to store language words in DB rather than in XML or flat file? :-)

cdmn

4:00 pm on Aug 15, 2007 (gmt 0)

10+ Year Member



Does anyone have any readings to this question? book, article, smth? :-)

Im going crazy...

LifeinAsia

4:51 pm on Aug 15, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



So in your opinion, you would prefer to store language words in DB rather than in XML or flat file? :-)

As I said, we use both.

In my testing on my system I found that in general reading a small flat file took less time than the call to open the DB connection and read the data. Larger sets of data may perform differently. Different DBs may provide different results. Different programming languages may provide different results. You'll need to do your own testing to see which is more efficient for your own purposes on your own system.

I am not aware of any books or tutorials- I learned by trial and error.

cdmn

7:39 pm on Aug 15, 2007 (gmt 0)

10+ Year Member



ok, thanks :-)

borntobeweb

8:19 pm on Aug 15, 2007 (gmt 0)

10+ Year Member



cdmn, i've never done internationalization in PHP but a quick search for "php i18n" led me to gettext() [ca.php.net] and this tutorial [zez.org]. You may find it useful.

Habtom

5:04 am on Aug 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What is the best way, to get the language words from DB, or XML file?

I hope this is not off the topic, but assuming you do it from a DB, how would your DB structure be. I have done this before but how would you ensure when another language is to be added, it won't be a great pain.

cdmn

6:47 am on Aug 16, 2007 (gmt 0)

10+ Year Member



Really appreciate your help guys. Thanks