0

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 Mandarin 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.

roxcerise
  • 3
  • 1
  • 5

1 Answers1

0

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.

James Williams
  • 4,221
  • 1
  • 19
  • 35
  • When you say, "save the post you add the language id for corresponding language", does the user/poster need to select it from a drop down box, or is it set automatically? – roxcerise Oct 06 '11 at 08:31
  • You can have it either way. If you only want Mandarin users to post Mandarin ads Then you can put it in automatically. – James Williams Oct 06 '11 at 13:50