in reply to Language or string templates?
Here's a fairly straightforward solution framework that may be suitable for your application.
Create a text/language file with this format:
. . . strCliDeactivated => 'Currently not active', strNotActive => 'date has not yet been reached', strExpired => 'date has been reached', . . .
Then in your main code, slurp in the whole file and create a hash which can then be used when required.
. . . my @global_data = <TEXT_LANG>; my %globals; eval "\%globals = ( @global_data )"; . . . print STDERR $globals{strExpired} if $expired; . . .
Update: Sorry, I had two solutions in my head - I posted half of each. I've added two lines to the main code replacing:
my %globals = ( @global_data );Apologies for any confusion.
Regards,
PN5
|
---|