问题
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