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