多语言 Web 应用程序的设计注意事项

发布于 2024-08-30 11:09:16 字数 128 浏览 7 评论 0原文

今天,一位面试官问我如何将阿拉伯语作为第二语言实现到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

小忆控 2024-09-06 11:09:16
  1. 确保您在网站上使用 UTF-8 编码。即便如此,也不像普拉克坎特提到的那样万无一失。
  2. 字符串 - 您需要严格本地化用户可能出现的每个字符串和短语。这意味着错误消息、状态栏消息、警报框、对话框等。您可以创建一个字符串映射或目录列表,让您可以通过键(可以是英文)查找字符串。
  3. 本地化图像 - 如果您使用按钮图像(包含文本),那么这些图像也需要本地化。您可以创建一个图像映射或目录文件,让您可以通过某个键查找适当文化的图像。
  4. 布局 - 由于阿拉伯语是从右到左的,因此您可能需要单独的 CSS 文件来正确处理网站外观,以便正确读取和显示文本。例如,您可能希望侧边栏位于屏幕右侧而不是左侧。
  5. 日期格式 - 您需要根据区域性代码设置日期格式,并确保正确解释基于日期的过滤器。
  6. 数据库排序规则 - 您需要确保数据库以 UTF-8 或 Unicode 格式存储数据。您还需要小心查询中搜索字符串的任何过滤器,除非这些字符串是阿拉伯语用户无法查看和更改的系统值。
  1. Ensure you are using UTF-8 encoding on the site. Even that isn't foolproof as prakscant mentioned.
  2. Strings - You would need to be disciplined in localizing every string and phrase that could appear to the user. That means error messages, status bar messages, alert boxes, dialog boxes etc. You might create a string map or directory listing which lets you find strings by key (which could be in English).
  3. Localized images - If you use images for buttons (that contain text), those too would need to be localized. You might create an image map or directory file that lets you find images for the appropriate culture by some key.
  4. Layout - Since Arabic is right-to-left, you would likely need to have separate CSS files to properly handle the site appearance so that the text read and displayed correctly. For example, you might want sidebars on the right side of the screen instead of the left.
  5. Date formats - You would need to format dates based on the culture code and ensure that filters based on dates were properly interpreted.
  6. Database collation - You would need to ensure that the database stored data in UTF-8 or Unicode format. You would also need to be careful about any filters inside of queries which searched on strings unless those strings are system values that are unviewable and unchangable by an Arabic user.
不知所踪 2024-09-06 11:09:16

非常重要的是创建强大的语言管理器来灵活加载特定于语言的字符串和设置。在 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.

喜你已久 2024-09-06 11:09:16

全部使用 UTF-8:

php 文件格式 -> UTF-8。

MySQL数据库-> UTF-8 统一码。

Use UTF-8 for all:

php File format -> UTF-8.

MySQL database -> UTF-8 Unicode.

赠佳期 2024-09-06 11:09:16

不知道为什么他们对你的回答不满意。
所有文本均采用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文