Framework solution
Before embarking on details of the code to achieve a range of gettext
services within a PHP5 framework, it is important to say that this code is adapted from original work done by Carlos Souza, and incorporated into Mambo 4.6 and subsequent releases. The code has been released under either GNU/GPL or the MIT License. Now to the details of how to apply gettext
to a PHP5 CMS framework.
The gettext implementation
Everything can be achieved regardless of whether gettext
is installed on the computer running the CMS framework, and irrespective of whether the PHP gettext
library is available. In the original implementation for Mambo, the exception to this was the gathering, by scanning code files, of strings for translation. This could only be done on a system where gettext
is installed, and the PHP software made a system call to cause gettext
to carry out the necessary scan. However, this requirement can be avoided by processing the code using the PHP token_get_all
function. In...