1#!/usr/local/bin/perl
2#
3#  Schwaebisch (irssi) 1.0.0
4#
5#  (c) 2000-2003 by Robert Scheck <irssi@robert-scheck.de>
6#
7#  Schwaebisch (irssi) is adapted from "schwob", a swabian translator
8#  by Jens Schweikhardt <schweikh@noc.dfn.de>
9#
10#  This program is free software; you can redistribute it and/or modify
11#  it under the terms of the GNU General Public License as published by
12#  the Free Software Foundation; either version 2 of the License, or
13#  (at your option) any later version.
14#
15#  This program is distributed in the hope that it will be useful,
16#  but WITHOUT ANY WARRANTY; without even the implied warranty of
17#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18#  GNU General Public License for more details.
19#
20#  You should have received a copy of the GNU General Public License
21#  along with this program; if not, write to the Free Software
22#  Foundation, Inc.,
23#  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24#
25
26
27use strict;
28
29use vars qw($VERSION %IRSSI);
30$VERSION = "1.0.0";
31%IRSSI = (
32    authors     => "Robert Scheck",
33    contact     => "irssi\@robert-scheck.de",
34    name        => "Schwaebisch",
35    description => "/schw�bisch - translates your messages from german to swabian",
36    license     => "GNU GPL v2",
37    url         => "http://ftp.robert-scheck.de/linux/irssi/scripts/",
38    modules     => "",
39    changed     => "$VERSION",
40    commands    => "schw�bisch"
41);
42
43use Irssi 20020324;
44
45sub schwaebisch ($)
46{
47  my ($text) = @_;
48
49  # Komplette Wortersetzungen:
50  $text =~ s/\b([Dd])a\b([^�])/$1o$2/g;
51  $text =~ s/\bdann\b/no/g;
52  $text =~ s/\bEs\b/S/g;
53  $text =~ s/\bes\b/s/g;
54  $text =~ s/\beine([sm])\b/oi$1/g;
55  $text =~ s/\bEine([sm])\b/Oi$1/g;
56  $text =~ s/\b([DdMmSs])eine?\b/$1ei/g;
57  $text =~ s/\b([DdMmSs])eins\b/$1eis/g;
58  $text =~ s/\b([DdMmSs])einer\b/$1einr/g;
59  $text =~ s/\beine\b/a/g;
60  $text =~ s/\bEine\b/A/g;
61  $text =~ s/\beiner\b/oinr/g;
62  $text =~ s/\bEiner\b/Oinr/g;
63  $text =~ s/\b([Ee])inen\b/$1n/g;        # einen -> en
64  $text =~ s/\b([Dd])as/$1es/g;           # das -> des
65  $text =~ s/\b[Ii]ch\b/I/g;              # ich -> i
66  $text =~ s/\b([Nn])icht\b/$1ed/g;       # nicht -> ned
67  $text =~ s/\b([Ss])ie\b/$1e/g;          # sie -> se
68  $text =~ s/\bwir\b/mir/g;
69  $text =~ s/\bWir\b/Mir/g;
70  $text =~ s/\b(he)?([Rr])unter/$2a/g;
71  $text =~ s/\b([Hh])at\b/$1ott/g;
72  $text =~ s/\b([Hh])aben\b/$1enn/g;
73  $text =~ s/\b([Hh])abe\b/$1ann/g;
74  $text =~ s/\b([Gg])ehen\b/$1anga/g;
75  $text =~ s/\b([Kk])ann\b/$1a/g;
76  $text =~ s/\b([Kk])�nnen\b/$1enna/g;
77  $text =~ s/\b([Ww])ollen\b/$1ella/g;
78  $text =~ s/\b([Ss])ollten\b/$1oddad/g;
79  $text =~ s/\b([Ss])ollt?e?\b/$1odd/g;
80  $text =~ s/\bdiese?r?\b/sell/g;
81  $text =~ s/\bDiese?r?\b/Sell/g;
82  $text =~ s/\b([Aa])uch\b/$1o/g;        # auch -> ao
83  $text =~ s/\b([Nn])och\b/$1o/g;        # noch -> no
84  $text =~ s/\b([Ss])ind\b/$1end/g;      # sind -> send
85  $text =~ s/\b([Ss])chon\b/$1cho/g;     # schon -> scho
86  $text =~ s/\b([Mm])an\b/$1r/g;         # man -> mr
87  $text =~ s/\b([Dd])ie\b/$1/g;          # die -> d
88  $text =~ s/\b([Dd])a?rauf\b/$1ruff/g;  # darauf -> druff
89  $text =~ s/\bviele?s?\b/en Haufa/g;
90  $text =~ s/\bViele?s?\b/En Haufa/g;
91  $text =~ s/\bAuto|Daimler\b/Heilix Blechle/g;
92  $text =~ s/Marmelade|Konfit�re/X�lz/g;
93  $text =~ s/\b2\b/zwoi/g;
94  $text =~ s/\b5\b/fempf/g;
95  $text =~ s/\b15\b/fuffzehn/g;
96  $text =~ s/\b50\b/fuffzig/g;
97
98  # Am Wortanfang und Gro�geschriebenes:
99  $text =~ s/\bAuf/Uff/g;
100  $text =~ s/\bauf/uff/g;
101  $text =~ s/\bEin/Oi/g;
102  $text =~ s/\bein/oi/g;
103  $text =~ s/\bMal/Mol/g;
104  $text =~ s/\bUm/Om/g;
105  $text =~ s/\bunge/og/g;
106  $text =~ s/\bUnge/Og/g;
107  $text =~ s/\bunver/ovr/g;
108  $text =~ s/\bUnver/Ovr/g;
109  $text =~ s/\bUn/On/g;
110  $text =~ s/\bun/on/g;
111  $text =~ s/\bUnd/Ond/g;
112  $text =~ s/\bin(s?)/en$1/g;            # in -> en,   ins -> ens
113  $text =~ s/\bIn(s?)/En$1/g;            # In -> En,   Ins -> Ens
114  $text =~ s/\bim/em/g;
115  $text =~ s/\bIm/Em/g;
116  $text =~ s/\b([Kk])ein/$1oin/g;
117  $text =~ s/\b([Nn])ein/$1oi/g;
118  $text =~ s/\b([Zz])usa/$1a/g;          # zusammen -> zamma
119
120  # Am Wortende:
121  $text =~ s/\Ben\b/a/g;                 # latschen -> latscha
122  $text =~ s/\Bel\b/l/g;                 # Sessel -> Sessl
123  $text =~ s/([^h])er\b/$1r/g;           # der -> dr
124  $text =~ s/([h])es\b/$1s/g;            # manches -> manchs
125  $text =~ s/\Bau\b/ao/g;                # lau -> lao
126  $text =~ s/([lt])ein\b/$1oi/g;         # Stein -> Stoi
127
128  # Beliebige Position:
129  $text =~ s/([Ff])rag/$1rog/g;
130  $text =~ s/teil/doil/g;
131  $text =~ s/Teil/Doil/g;
132  $text =~ s/([Hh])eim/$1oim/g;
133  $text =~ s/steht/stoht/g;
134  $text =~ s/um/om/g;
135  $text =~ s/imm/emm/g;                  # schlimm -> schlemm
136  $text =~ s/mal/mol/g;
137  $text =~ s/zwei/zwoi/g;
138  $text =~ s/ck/gg/g;
139  $text =~ s/([Ee])u/$1i/g;
140  $text =~ s/([Vv])er/$1r/g;
141  $text =~ s/([Gg])e([aflmnrs])/$1$2/g;  # angenommen -> angnommen
142  $text =~ s/([Ss])t/$1chd/g;            # st -> schd
143  $text =~ s/([Ss])p/$1chb/g;            # sp -> schb
144  $text =~ s/tio/zio/g;                  # Information -> Informazion
145  $text =~ s/\?/, ha?/g;
146  $text =~ s/!!/, Sagg Zemend!/g;
147  $text =~ s/!/, haidanai!/g;
148
149  # Spezielles:
150  $text =~ tr/TtPp����/DdBbEeIi/;        # Globale Transformationen zum Schluss
151
152  # Was nach 'tr' stehen muss:
153  $text =~ s/ung/ong/g;
154  $text =~ s/und/ond/g;
155  $text =~ s/ind/end/g;
156
157  return $text;
158}
159
160sub cmd_schwaebisch ($$$)
161{
162  my ($arg, $server, $witem) = @_;
163  if ($witem && ($witem->{type} eq 'CHANNEL' || $witem->{type} eq 'QUERY'))
164  {
165    $witem->command('MSG '.$witem->{name}.' '.schwaebisch($arg));
166  }
167  else
168  {
169    print CLIENTCRAP "%B>>%n ".schwaebisch($arg);
170  }
171}
172
173Irssi::command_bind('schw�bisch', \&cmd_schwaebisch);
174