PHP 本地化问题

标签 php localization gettext

我正在构建一个开源产品,我正在考虑本地化,我读过 gettext但是让它在不同的系统(服务器、操作系统等)中工作似乎有很多问题。

你会如何处理?有没有一种安全的方法可以帮助 gettext 在多个系统上工作?也许它已经是?

来自瑞典/托拜厄斯的问候

最佳答案

我建议你看看Zend_translate , Zend_localeZend_Date .我自己才刚刚开始涉足它们,但对我来说,与困惑的 gettext 相比,它们看起来已经是一个非常好的、干净的和现代的国际化解决方案。

Zend_translate 的介绍列出了为什么选择它(或类似的东西)而不是 gettext 的一些强有力的论据。

In multilingual applications, the content must be translated into several languages and display content depending on the user's language. PHP offers already several ways to handle such problems, however the PHP solution has some problems:

Inconsistent API: There is no single API for the different source formats. The usage of gettext for example is very complicated.

PHP supports only gettext and native array: PHP itself offers only support for array or gettext. All other source formats have to be coded manually, because there is no native support.

No detection of the default language: The default language of the user cannot be detected without deeper knowledge of the backgrounds for the different web browsers.

Gettext is not thread-safe: PHP's gettext library is not thread safe, and it should not be used in a multithreaded environment. This is due to problems with gettext itself, not PHP, but it is an existing problem.

关于PHP 本地化问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2149116/

相关文章:

php - Yii 中带有 ENUM 的下拉框

java - 在 JSF 中使用 bean 验证进行本地化

c# - 使用语言代码 (en) 还是完整的文化代码(例如 en-AU)?

php - 单击按钮调用函数,获取 url

php - MySQL根据日期时间字符串的日期和时间排序

Android Edittext-清除跨度

java - Android:应用程序在对话框中获取 editText 文本时崩溃

Java:将 TextField 保存到另一个类中使用的字符串

php - WooCommerce 触发订单状态完成的功能

ios - 在代码中查找 iOS 应用程序的当前本地化