i18n with gettext but without the locale hassle?(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 实现?或者有人知道另一种简单、小巧、快速 (!) i18n 的 PHP 解决方案,它可以处理 .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 但没有语言环境的麻烦?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:i18n 与 gettext 但没有语言环境的麻烦?


基础教程推荐
- 在多维数组中查找最大值 2021-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01