Internationalization in PHP

后端 未结 4 595
鱼传尺愫
鱼传尺愫 2020-12-03 06:15

I am currently researching the best methods to integrate i18n into projects.

There\'s several methods I have thought of doing this, first being a databa

相关标签:
4条回答
  • 2020-12-03 06:18

    I've implemented a XML translation utility as part of a bigger project. You can find it here, and a sample translation file is here (en_US).

    0 讨论(0)
  • 2020-12-03 06:29

    Have a look at the Gettext (http://php.net/manual/en/book.gettext.php) library.

    Don't put your text into a database. That'll just make life hard on the translation team.

    0 讨论(0)
  • 2020-12-03 06:36

    In addition to gettext already mentioned, PHP 5.3 has native Internationalization support

    If that's not an option, consider using Zend Framework's Zend_Translate, Zend_Locale and related components for that. Zend_Translate supports a number of adapters, including but not limited to simple arrays, gettext, XmlTm and others.

    0 讨论(0)
  • 2020-12-03 06:36

    The most impressive method to study is Drupal's implementation. Second best, would be Wordpress. Both use gettext and .pot/.po/.mo for localization. And, the good thing is that there is a beautiful Open Source .po editor called Poedit. It's available for Windows System users, which gives a wider appeal. It's also available for Mac and Linux. Check it out here: http://www.poedit.net/

    0 讨论(0)
提交回复
热议问题