PHP本地化问题 [英] PHP Localization Question

查看:72
本文介绍了PHP本地化问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个开源产品,并且正在考虑本地化,我已经阅读了 gettext ,但要使其在不同的系统(服务器,操作系统等)中运行似乎有很多问题.

I'm building a Open Source product and I thinking about Localization, I've read about gettext but there seems to be a lot of problem to get it to work in different systems (servers,os etc).

您将如何处理?有没有安全的方法来帮助gettext在多个系统上工作?也许已经是?

How would you handle this? Is there a secure way to help gettext work on several systems? Perhaps it already is?

来自瑞典/托比亚斯的问候

Regards from Sweden / Tobias

推荐答案

我建议您看看 Zend_locale

I recommend you take a look at Zend_translate, Zend_locale and Zend_Date. I'm only starting to dabble with them myself, but to me, they already look like a really good, clean and modern solution to internationalization, in contrast to the chaos that is gettext.

Zend_translate的简介列出了许多有力的理由,为什么要在gettext上选择它(或类似的东西).

The introduction to Zend_translate lists a number of strong arguments why to choose it (or something similar) over gettext.

在多语言应用程序中, 内容必须翻译成 几种语言和显示内容 取决于用户的语言.的PHP 提供了几种处理方式 这样的问题,但是PHP 解决方案存在一些问题:

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:

API不一致:不同来源没有单个API 格式. gettext的用法 例子很复杂.

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

PHP仅支持gettext和本机数组:PHP本身仅提供 支持数组或gettext.全部 其他源格式必须进行编码 手动,因为没有本地 支持.

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不是线程安全的:PHP的gettext库不是线程 安全,不应在 多线程环境.这个到期了 解决gettext本身的问题,而不是 PHP,但这是一个现存的问题.

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本地化问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆