🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #173345

[Dialog] Automatic choice of language in a script

#173345
From: Bertel Lund Hansen
Date: Wed, 14 Sep 2005 09:00
73 lines
3214 bytes
Hi all

I use an event script to put a message in my postings if they are
crossposted or if FollowUp is set. The text is Danish and of
little interest for English-speaking people.

Is there a way to make the script choose between different
languages automatically? It would be okay if it has a default
choice and otherwise is triggered by groupnames containing
"english" or "deutsch".

Here is the script though I don't suppose that the language part
depends on the rest. The comments are in Danish, and the script
is modified from one of the Wiki scripts.

program OnBeforeSendingMessage;

// Udskift evt. teksten:
const
  messageXPost = 'Xpostet til:';
  messageFut   = 'Fut til:';
  messageInfo  = 'Svar herpå sendes dertil hvis det ikke aktivt
forhindres.';
//  {$define EMPTYLINE} // Laver en tom linje mellem info og sig.
const
  headerFollowupTo = 'Followup-To:';
  headerNewsgroups = 'Newsgroups:';

function OnBeforeSendingMessage (var message: TStringlist;
servername: string; isEmail: boolean):boolean;
var
 i, sigline: integer;
 s, futGroup, xpostGroups: string;
begin
 result:=true; // False hvis beskeden ikke skal sendes.
 if isEmail then exit;
 for i:=0 to message.count-1 do begin
  s:= message.strings[i];
  if s='' then break;
  // +1 i de to linjer skipper et kolon som allerede findes i
variablerne.
  if Pos(headerFollowupTo,s)>0 then
futGroup:=copy(s,length(headerFollowupTo)+1,999);
  if Pos(headerNewsgroups,s)>0 then
   if Pos(',',s)>0 then
xpostGroups:=copy(s,length(headerNewsgroups)+1,999);
 end;
 for i:=message.count-1 downto 0 do 
  if message.strings[i]='-- ' then break;
 // Sørg for at der er noget at indsætte foran.
 if i<1 then
  sigline:=message.count+1
 else
  sigline:=i; 
{$ifdef EMPTYLINE}
  if (futGroup>'') or (xpostGroups>'') then
message.Insert(sigline,'');
{$endif}
 if futGroup>'' then begin 
  message.Insert(sigline,messageInfo);
  message.Insert(sigline,messageFut+futGroup); 
 end;
 if xpostGroups>'' then
message.Insert(sigline,messageXPost+xpostGroups);
end;


Begin
End.

-- 
Bertel
http://bertel.lundhansen.dk/		http://fiduso.dk/
Technical Details
Message-ID: <1j9uz2hbgx43u.hsbeolg8va1c.dlg@40tude.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!atl-c02.usenetserver.com!news.usenetserver.com!atl-c07.usenetserver.com!news.usenetserver.com!newsfeed101.telia.com!nf02.dk.telia.net!news104.dk.telia.net!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <1j9uz2hbgx43u.hsbeolg8va1c.dlg@40tude.net>
Subject: [Dialog] Automatic choice of language in a script
Date: Wed, 14 Sep 2005 11:00:28 +0200
From: Bertel Lund Hansen <nospamfilius@lundhansen.dk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!atl-c02.usenetserver.com!news.usenetserver.com!atl-c07.usenetserver.com!news.usenetserver.com!newsfeed101.telia.com!nf02.dk.telia.net!news104.dk.telia.net!not-for-mail
Newsgroups: news.software.readers
User-Agent: 40tude_Dialog/2.0.15.1
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
Lines: 73
NNTP-Posting-Host: 212.10.71.193
X-Trace: news.stofanet.dk 1126688093 7637 212.10.71.193:33100
X-Complaints-To: Telia Stofa Abuse <abuse@stofa.dk>