开发者

With regards to creating multi-language site

Hi, I am going to build a classifieds website using PHP/MySQL.

This website is going to be available in 3 languages, English being default.

I would not need translation, as I'd be writing 3 of those languages for the structure,

and the user generated content need not be translated.

For how to create multi-language sites, I'm referring to http://stackoverflow.com/questions/450687/programming-multi-language-php-applications

currently.

The user scenario would be, if user chose Manda开发者_开发百科rin as the main language,

he/she will be viewing most of the ads that are written in Mandarin,

and *any postings done by he/she would be automatically listed as a Mandarin ad*.

How do I do that in MySQL? (Create a "Language" field?)

Thank you for any help in advance.


There is a normalized database approach.

a) One table for keeping language information with columns (id, languageName)

b) In the ad table you would add a column for language id

Then when you would search for the language Mandarin you would query the ad table with either the "WHERE languageID = 2".

Now when you save the post you add the language id for the corresponding language.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜