Language Support - GetText

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
AlexC
Forum Commoner
Posts: 83
Joined: Mon May 22, 2006 10:03 am

Language Support - GetText

Post by AlexC »

Hey,

I'm building (nearly finished) my own MVC framework that is being used to power a content management system I am creating, however I would like to add language-support to my framework. I could easily create a new php file and put an array in it, with the different langauge phrases and translations, however I have also heard about GetText to provide translations.

Is it a bad idea to use GetText, or will my project benefit from it? I have found a script called php-gettext which you can use instead of the default php gettext functions, which I would use if I do go the GetText route as not all PHP installs have gettext enabled or installed on the system.

How do you do you're language support/translations, should I use Gettext?
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

This is a matter of personal taste (personally I don't like gettext). Look at the Zend Framework Documentation for a couple of additional options. You may also want to check out search on these forums. One topic that spring to mind...
Multilanguage support
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

I'm fairly sure an XML format tends to be popular outside smaller applications. Once you run into a PHP Array you'll end up with dozens of translators not fully familiar with the syntax. Gettext is not as bad, but the final format is only machine readable. XML, often overlooked because it's "slow" is both easily handled in PHP, and is human readable. The Zend Docs have support for the two dominant XML formats.

Edit: The database is another option though it depends on implementation. If you have access to SQLite might be worth looking into.
Post Reply