关于创建多语言网站
你好,我将使用 PHP/MySQL 建立一个分类网站。
该网站将提供 3 种语言版本,默认英语。
我不需要翻译,因为我会为结构编写其中 3 种语言,
并且用户生成的内容不需要翻译。
关于如何创建多语言网站,我指的是 http://stackoverflow.com/questions/450687/programming-multi-language-php-applications
现在。
用户场景是,如果用户选择普通话作为主要语言,
他/她将看到大部分用普通话写的广告,
并且*他/她发布的任何帖子都会自动列为普通话广告*。
我如何在 MySQL 中做到这一点? (创建“语言”字段?)
提前感谢您的帮助。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一种标准化的数据库方法。
a) 一个用于保存语言信息的表,其中包含列 (id, languageName)
b) 在广告表中,您将添加一列语言 id
然后,当您搜索语言普通话时,您将使用“WHERE languageID”查询广告表= 2”。
现在,当您保存帖子时,您可以添加相应语言的语言 ID。
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.