多语言 Web 应用程序的设计注意事项
今天,一位面试官问我如何将阿拉伯语作为第二语言实现到 PHP Web 应用程序中。我谈到了为数据库和前端选择 unicode 编码,以及设计 RTL 友好的用户界面模块。他似乎对这个答案不太满意。我对多语言系统一无所知,你会如何回答这个问题?
I was asked by an interviewer today how I would implement Arabic as a second language into a PHP web application. I talked about choosing a unicode encoding for the database and the front-end, and designing RTL friendly user interface modules. And he didn't seem too happy with the answer. I don't really know anything about multi-lingual systems, how would you have answered that question?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
非常重要的是创建强大的语言管理器来灵活加载特定于语言的字符串和设置。在 PHP 中,即使使用 UTF-8 文件格式,您也必须小心,因为当前的 PHP 版本没有完整的 unicode 支持。您可以在这里阅读有关 unicode 支持的更多信息:
http: //schlueters.de/blog/archives/128-Future-of-PHP-6.html
您还有更多问题需要处理:本地化格式化、排序 - 校对、多货币和多时区逻辑。
very important thing is to make robust language manager for flexible loading of language-specific strings and settings. In PHP you have to be careful even with UTF-8 file format, because current PHP versions doesn't have complete unicode support. Here you can read more about what's happening with unicode support:
http://schlueters.de/blog/archives/128-Future-of-PHP-6.html
You have also many more problems to deal with: localized formatting, sorting - collation, multi-currency and multi-timezone logic.
全部使用 UTF-8:
php 文件格式 -> UTF-8。
MySQL数据库-> UTF-8 统一码。
Use UTF-8 for all:
php File format -> UTF-8.
MySQL database -> UTF-8 Unicode.
不知道为什么他们对你的回答不满意。
所有文本均采用 UTF-8 - 字符串/数据库等。
单独的CSS(设置rtl文本属性)
其他需要考虑的事情......图像也是 RTL 的。因此,如果您当前将图像用于导航栏等,则必须意识到它们将加载 RTL。
除此之外,阿拉伯语只是另一种语言,就像其他语言一样,唯一的区别是它是双向的。
Not sure why they wouldn't be happy with your answer.
UTF-8 for all text - strings/database, etc.
Separate CSS (to set the rtl text property)
Other thing to take into consideration... images are also rtl. So if you currently use images for a navbar, etc., you have to realize that they will load rtl.
Other than that, Arabic is just another language like anything else, the only difference is that it's bi-directional.