i18n有gettext但没有语言环境的麻烦吗? [英] i18n with gettext but without the locale hassle?

查看:90
本文介绍了i18n有gettext但没有语言环境的麻烦吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种符合标准的方法来存储Web应用程序的多语言内容.到目前为止,我已经使用了自己的"translate()"函数,该函数从数据库中的文件或字典表中读取数据.但是,如果使用Web应用程序的不同副本,则使字典保持在数据库表中的最新状态非常麻烦.

I am looking for a standards-compliant way to store multi-language content for a Web Application. Until now, I have employed my own "translate()" functions that read data from a file or a dictionary table in a database. However, keeping the dictionaries up to date in a database table is very cumbersome if you work with different copies of the web app.

我喜欢gettext,因为有许多可用的工具.但是,我为不同的平台开发应用程序.我绝对不愿意使用setlocale()和consorts的糟糕方法-即数十种不同的语言环境字符串变体,这些变体因系统而异,而您需要提供这些变体才能使其正常工作.永远不能.我有一组语言-例如de,en和es-并且我想加载适当的字典并使用_()而不接触一次setlocale()或bindtexdomain().

I like gettext because there is a multitude of tools available for it. However, I develop applications for different platforms. I am absolutely unwilling to deal with the crappy ways of setlocale() and consorts - namely the dozens of different locale string variations differing from system to system that you need to provide for to get it working. Never ever. I have a set of languages - say de, en, and es - and I want to load the appropriate dictionary and work with _() without touching setlocale() or bindtexdomain() once.

使用gettext可以通过某种方式实现吗?还是有人知道另一个适用于PHP的简单,小型,快速(!)i18n解决方案,该解决方案可以使用.po/.mo文件,最好不需要PHP扩展名?

Is this somehow possible using gettext? Or does somebody know another simple, small, fast (!) i18n solution for PHP that can work with .po/.mo files, preferably without requiring a PHP extension?

推荐答案

Zend_Translate可以使用

Zend_Translate works with it

http://framework .zend.com/manual/en/zend.translate.adapter.html#zend.translate.adapter.gettext

这篇关于i18n有gettext但没有语言环境的麻烦吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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