code and messages

M

Me

I recently started coding with perl again after a rather long spell with
python and php. On one of the long running php projects (with people
always changing their minds) that I worked, all the error messages that
were visible to the end user were configurable. This was to meant avoid
coding when messages needed to be changed. Even the email messages were
configurable. The solution was not a neat one, and was at times a
headache to maintain (and thats putting it mildly).

What I would to find out is not neccesarily perl specific. But, perl is
what I am focusing on. What tools/methods are available to allow for
separation of "visible end user text" and code? I currently use template
to seperate code from design, that is not what I am looking for?

Taking it a step further, would be to say can I also get translation as
well so that messages are not just in English? This is just a nice to have.


Any suggestions? Comments?
 
S

Sherm Pendley

Me said:
Taking it a step further, would be to say can I also get translation as
well so that messages are not just in English?

In C that's often done with gettext. There's a Gettext module on CPAN, but
it looks to be abandoned - the last update was in 2000.

sherm--
 
B

Big and Blue

Me said:
What I would to find out is not neccesarily perl specific. But, perl is
what I am focusing on. What tools/methods are available to allow for
separation of "visible end user text" and code? I currently use template
to seperate code from design, that is not what I am looking for?

Well, something non-Perl specific and relativley easy to implement in
Perl (and then use the same message from any other language).

Put every message and mail message into a file whose name is mnemonic,
then just read the contensts of that file name when required. Write a
module to do the getting.
Taking it a step further, would be to say can I also get translation as
well so that messages are not just in English? This is just a nice to have.

Allow for the files to be in a deault dir, or one named on after the
locale.

Ths is the sort of thing which gettext does, but it would be qute easy
to implement on its own.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top