views:

96

answers:

1

Situation is simple. I'm starting to develop a website that should be localized based on visitor's origin IP address.

It's a PHP-MySQL stack. How do I go about the multilingual text content? I am thinking of having a language table in the database with the primary key as content identifier, another column for page identifier and separate columns for content in each language. Appropriate page content will be fetched as an array in the requested language and then displayed on the page.

Is this an efficient solution? I somewhat feel ridiculous to make database calls just for static content. I thought of having PHP definition files for each language and load the definitions during page load. But updating the definitions for each language are going to be like editing the files manually.

Has someone come out with an efficient solution for this kind of situation? Any input is much appreciated.

+2  A: 

If the content is static like you say, why not use Gettext?

It's the standard regarding localization of content and has been discussed lots of times in StackOverflow.

Alix Axel
+1 for gettext. Not only is it the standard language agnostic solution, but using the 'English' text as the 'content identifier' just makes sense.
slebetman
Thank you! I didn't know about Gettext before. Seems to be what I am looking for.
Nirmal