I've been surprised by how little I've found on externalizing strings in PHP. Does everyone use gette开发者_如何转开发xt, or is there some other framework or tool that I'm not aware of?
Zend_Translate / Zend_Locale are nice and very flexible. They do not need the whole Zend Framework to be present. They support gettext moo/.po files but also CSV and other formats.
Hope this library helps you:
The i18n package is a punch of classes for internationalization. It gives you the possibility to maintain multilanguage webpages more easily. The translation strings are stored in flat text files, special Gettext files which are basically precompiled translation files or in a MySQL database. And it works independently from PHP’s setlocale function.
I would say that you should use gettext because it is mature and easy to setup. Also BU using gettext you will be able to extend its useage for other type of sources than php. Consider the PO file format the standard for this.
Im working in i18n area for many years and I can tell you that gettext will provide you best results with minimal efforts if you have more than 50-100 strings in your project.
Once you've set the foundation for localizing your application, if you find yourself needing to manage and / or just get the actual translation done we have (what I like to think, obviously :) a pretty cool tool called String - http://mygengo.com/string
String is great for not just managing translations, where you can invite others to projects to help with translation, but you can order translations right in the service too. We've integrated our API into String to showcase our API and the ability to see status updates for numerous (100s...1000s) of jobs, translated by real people!
If you're interested in the API itself, we held a bounty contest not long ago with some fun winners for a number of platforms (Wordpress, Django, etc.): http://mygengo.com/services/api/lab/winners/
Just thought I'd share.
精彩评论