本地化使用什么(php/smarty/pear 应用程序)?

我有一个 php/smarty/pear 应用程序,它有自己的本地化实现,涉及使用字符串的 id 并且字符串存储在数据库中.目前该应用程序只有英文,但我将开始添加其他语言.当前的实现非常糟糕,基本上我不是重新发明轮子的忠实粉丝.

I have a php/smarty/pear app that has it's own localization implementation that involves using ids for strings and the strings are stored in a db. currently the app is only in English but I will start adding other languages. The current implementation is very poor and basically I'm not a big fan of re-inventing the wheel.

任何人都可以推荐用于本地化的内容吗?几年前我用过gettext,现在还在用还是有更新更好的东西?

Can anybody recommend what to use for localization? I had used gettext years ago, is that still used or is there something newer and better ?

提前致谢.

推荐答案

我会使用 gettext,因为它是一个成熟的系统,并提供单/复数翻译等功能.为了不依赖于 php 扩展的可用性,你应该回退到 http://launchpad.net/php-gettext 提供了 gettext 的纯 php 实现.

I would use gettext, since it's a mature system and provides features like singular/plural versions of translations. To be not dependant on the availability of the php extension, you should fall back to http://launchpad.net/php-gettext which provides a pure php implementation of gettext.

gettext 还有一个很大的优势,那就是存在许多可以轻松翻译这些文件的工具.

gettext has also the big advantage that dozens of tools exist that make it easy to translate those files.

相关文章