Newlines in language strings
Julian Field
MailScanner at ecs.soton.ac.uk
Thu Jun 2 16:38:31 IST 2005
Please try the attached Config.pm. I have implemented \n everywhere.
I did it differently from your version, mine should be very slightly
faster. Please let me know how you get on.
------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
'leave mailscanner' in the body of the email.
Before posting, read the Wiki (http://wiki.mailscanner.info/) and
the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).
Support MailScanner development - buy the book off the website!
[ Part 2, Application/X-GZIP 26KB. ]
[ Unable to print this part. ]
[ Part 3: "Attached Text" ]
On 2 Jun 2005, at 15:13, Chuck Foster wrote:
> Hi,
>
> One of the patches I need to apply to each new version of
> MailScanner is a
> notification message that I wish to place at the top of each message
> generated in the MessageBatch::WarnLocalPostmaster function. Now, in
> principle I could get around having to patch the code by using the
> 'noticeprefix' language string instead; however, that doesn't allow
> interpret newlines so I couldn't use this in the way I wanted for
> that.
>
> Now, how much pain could it cause elsewhere to have the string
> returned
> checked for newlines and subsequently used in output? Indeed, what
> if that
> is taken a step further for %percent% and ENV vars too? I was thinking
> something like:
>
>
> sub DoLineExpansion { # like DoPercentVars but with ENV too
> my ($string) = @_;
> $string =~ s/\%([^%]+)\%/$PercentVars{lc($1)}/g;
> $string =~ s/\$\{?(\w+)\}?/$ENV{$1}/g;
> $string =~ s/\\n/\n/g;
> $string;
> }
>
> sub LanguageValue { return &DoLineExpansion( FindLanguageValue
> ( @_ ) ); }
>
>
> ... where the original LanguageValue function is renamed
> FindLanguageValue;
> thus, I could then have a line in languages.conf like:
>
> Notice Prefix: This is a line blah blah\nwith text on another
> line\nFrom %org-long-name%
>
> What could go horribly wrong ... ?!!!
>
> (I guess this expansion could probably be extended to Value() and
> QuickPeek() too at some point ...)
>
> Chuck
>
>
> This message should be regarded as confidential. If you have
> received this
> email in error please notify the sender and destroy it immediately.
> Statements of intent shall only become binding when confirmed in
> hard copy
> by an authorized signatory.
>
>
> --
> This message has been scanned for viruses and potentially
> harmful content by StreamShield Protector.
>
> ------------------------ MailScanner list ------------------------
> To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
> 'leave mailscanner' in the body of the email.
> Before posting, read the Wiki (http://wiki.mailscanner.info/) and
> the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).
>
> Support MailScanner development - buy the book off the website!
>
>
--
Julian Field
www.MailScanner.info
Buy the MailScanner book at www.MailScanner.info/store
PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
'leave mailscanner' in the body of the email.
Before posting, read the Wiki (http://wiki.mailscanner.info/) and
the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).
Support MailScanner development - buy the book off the website!
More information about the MailScanner
mailing list