The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Hybrid View

Offer multiple languages

Hi,

Is there a specific way of offering sites in different languages, or does everyone just develop there own method of doing it?

I need to offer my site in a couple of different languages and hoped there was a more efficient way that just storing ALL the text in a database and extracting the correct one depending on language settings.

A common way of doing it is to create different language files. Each file would be a series of defines of the same phrases in different languages. Depending on user preferences you would require_once the appropriate language file.

Then you'd just use the defines throughout the script. Like ID_WELCOME_GREETING, which would be defined in each language file as however that message should be translated.

I do this in my projects which are only meant for one language, as well. This allows the non technical people involved in my project to change the phrasing that I've selected.