Displaying website in multiple languages?

This is driving me nuts

I have a site in english, and i need the option to display it in other languages. The first language to display it in is Korean

Anyone know where to begin on this? I was going to use session variables to set the language option, then use a database to fetch the content. is there a better way?

p.s. i hate clients. 14 f-cking hours i’ve been at work today

I would say your on the right track. You may want to consider cookies instead in order to save their preference of language for their next visit.

If you have elements in your design you want to change, such as navigation, I’ll just create a new file for each language with common variable names but with the values in different languages then load whichever file depending on their choice.

If you’re going to have a lot of different languages, you should look into gettext. You would still need to have translations for every bit of text, but you wouldn’t need to replicate every file.

You might also be able to use the Accept-Language HTTP header to determine what language to use.

I don’t know how the RTL <-> LTR works though, sorry.

hmmm these two things sound a bit beyond my level of experience. Anyway you could dumb it down for me? or provide a tutorial?

Also, i thought i would have to change the charset and font-family for each new language??? (which seems like a pain)

And yes, it is just the navigation and some of the content i need to translate, not the entire site

thanks for your help


<?php $site_title = 'My Site Title in English'; ?>


<?php $site_title = 'My Site Title in Spanish'; ?>

Then your main file would be something like,

<?php include $_SESSION['user_language'] . '.lang.php'; ?>

Then when you use the $site_title variable, it’ll be different depending on file that is included.

Yep that’s how i’ve done it so far. But i have a problem with character encoding. For example, trying to display Korean characters appear square boxes. This is the part that’s confusing me. It has something to do with charset and fonts (i think), but i’m unsure how to approach this.

Here’s some korean copied and pasted, i wonder if it displays correctly


If you’re seeing “square boxes” or “question marks” it suggests that you don’t have the needed font on your machine. Or maybe your browser settings for Character Encoding are off?

Try the UTF8 char set…

In your CSS use direction to change the letters from right to left:

text-align: right;
direction: rtl;