开发者

How to deal with multilingual web content?

开发者 https://www.devze.com 2022-12-16 21:39 出处:网络
Situation is simple. I\'m starting to develop a website that should be localized based on visitor\'s origin IP address.

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 a开发者_JS百科nd 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号