【问题标题】:Can PHP's gettext extension be used on Google Cloud Platform / Google App Engine?PHP 的 gettext 扩展可以在 Google Cloud Platform / Google App Engine 上使用吗?
【发布时间】:2016-06-01 16:44:59
【问题描述】:

我在我的项目中使用 php_gettext 扩展来使用“.mo”文件翻译字符串。我正在将项目转移到 Google 的云平台,但显然未启用 php_gettext 扩展(请参阅here)。

有没有办法安装这个扩展?如果没有,PHP 国际化有什么替代方案?

【问题讨论】:

标签: php google-app-engine google-cloud-platform php-gettext


【解决方案1】:

在一个已经SO tread的库似乎可以工作,你可以使用性能更好的php-gettext-memcached

【讨论】:

    【解决方案2】:

    他们仍然不支持gettext 扩展(现在是 2016 年 6 月,2014 年 10 月开始发行),所以最后我使用了this gettext library,效果很好。

    我使用以下代码检查gettext 扩展是否已启用,只有在未启用的情况下,才加载库。如果将来启用扩展,我的代码将准备好。在本地,我确实启用了它,它工作得很好。

    if (!function_exists('gettext'))
        require_once __DIR__ . '/../libs/gettext/gettext.inc';
    

    您仍然可以为问题here 投票,以便 Google 开始实施它。

    【讨论】:

      猜你喜欢
      • 2019-02-09
      • 2014-05-28
      • 1970-01-01
      • 1970-01-01
      • 2023-03-15
      • 1970-01-01
      • 2012-10-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多