I have a question concerning the design of my project’s Code.
In most cases, it is important to separate content from code (HTML mixed with PHP in bigger apps=No good idea, etc.) but how should I handle things like the text of error messages?
Assuming this one message will be only used in one case/PHP file:
MessageBox( 'Something gone wrong, probably your fault' );
or
MessageBox( Lang::error_usersfault );
(Where Lang is a class located in some config file, full of consts)
-
If you have any experiences (I think every PHP programmer will come across something like this) with things like in the example above – What are they? How do you solve it?
-
What is the better solution?
May be you’ll find php extension
gettextuseful?PHP Manual of Gettext::gettext