i18n in Google App Engine - PHP

旧巷老猫 提交于 2019-12-22 21:44:55

问题


I'm trying to implement i18n in GAE - PHP via the gettext extension, but it fails, I suppose the extension is not enabled in GAE as of now.

I've tried using the php-gettext class, and it works fine, but I'm a bit concerned about its speed. As you can see in this benchmark the class is the slowest method.

Do you know any other way I can use? I'd prefer to use the php-gettext class and the .po files rather than string ids, but I also don't want to slow down the site.

Thanks a lot! :)


回答1:


Since app engine 1.9.22, the intl extension is available, although it has to be activated. Just include it in your php.ini file as such:

extension = "intl.so"

(as mentioned in Google App Engine's issue tracker on June 11th 2015)




回答2:


You can try the library php-gettext-memcached. It was built on top of the php-gettext library, and caches parsed translation data using Google's memcached service, hence increasing its speed.

Performance benchmark

Disclaimer: I wrote this library.



来源:https://stackoverflow.com/questions/17476154/i18n-in-google-app-engine-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!