commit | author | age
|
8bd4d9
|
1 |
<?php |
JK |
2 |
class bot_lang_init implements BotModuleInit { |
|
3 |
private $languages = array( |
|
4 |
'pol' => 'pl', |
|
5 |
'pl' => 'pl', |
|
6 |
'p' => 'pl', |
|
7 |
|
|
8 |
'ang' => 'en', |
|
9 |
'a' => 'en', |
|
10 |
'eng' => 'en', |
|
11 |
'en' => 'en', |
|
12 |
'e' => 'en', |
|
13 |
|
|
14 |
'niem' => 'de', |
|
15 |
'nie' => 'de', |
|
16 |
'ni' => 'de', |
|
17 |
'n' => 'de', |
|
18 |
'de' => 'de', |
|
19 |
'd' => 'de', |
|
20 |
|
|
21 |
'wlo' => 'it', |
|
22 |
'wl' => 'it', |
|
23 |
'w' => 'it', |
|
24 |
'ita' => 'it', |
|
25 |
'it' => 'it', |
|
26 |
'i' => 'it', |
|
27 |
|
|
28 |
'esp' => 'es', |
|
29 |
'es' => 'es', |
|
30 |
'hiszp' => 'es', |
|
31 |
'hisz' => 'es', |
|
32 |
'his' => 'es', |
|
33 |
'hi' => 'es', |
|
34 |
'h' => 'es', |
|
35 |
|
|
36 |
'fra' => 'fr', |
|
37 |
'fr' => 'fr', |
|
38 |
'f' => 'fr', |
|
39 |
); |
|
40 |
|
|
41 |
function register() { |
|
42 |
$handler = array( |
|
43 |
array( |
|
44 |
'file' => 'handler.php', |
|
45 |
'class' => 'bot_lang_module', |
|
46 |
'method' => 'handle', |
|
47 |
) |
|
48 |
); |
|
49 |
|
|
50 |
$return = array(); |
|
51 |
foreach($this->languages as $c1 => $l1) { |
|
52 |
foreach($this->languages as $c2 => $l2) { |
|
53 |
if($l1 == $l2) continue; |
|
54 |
|
|
55 |
$handler[0]['params'] = array($l1, $l2); |
|
56 |
$return[$c1.$c2] = $handler; |
|
57 |
} |
|
58 |
} |
|
59 |
|
|
60 |
$handler[0]['method'] = 'typo'; |
|
61 |
unset($handler[0]['params']); |
|
62 |
|
|
63 |
foreach($this->languages as $c1 => $l1) { |
|
64 |
if(!isset($return[$c1])) { |
|
65 |
$return[$c1] = $handler; |
|
66 |
} |
|
67 |
} |
|
68 |
|
|
69 |
return $return; |
|
70 |
} |
|
71 |
|
|
72 |
function help($params = NULL) { |
|
73 |
if($params === NULL) { |
|
74 |
return new BotMsg('<b>[J1][J2]</b> <i>zdanie</i><br />'."\n" |
|
75 |
. ' Tłumaczy zdanie lub słowo z języka [J1] na język [J2] (pol, ang, nie, his, wlo, fra)<br /><br />'."\n"); |
|
76 |
} |
|
77 |
else |
|
78 |
{ |
|
79 |
return new BotMsg('<b>[J1][J2]</b> <i>zdanie</i><br />'."\n" |
|
80 |
. ' Tłumaczy zdanie lub słowo podane w parametrze z języka [J1] na język [J2]<br /><br />'."\n\n" |
|
81 |
|
|
82 |
. 'Dostępne języki: pol, ang, nie, his, wlo, fra<br /><br />'."\n\n" |
|
83 |
|
|
84 |
. '<u>Przykłady:</u><br />'."\n" |
|
85 |
. 'polang Dzień dobry<br />'."\n" |
|
86 |
. 'angnie Good morning'); |
|
87 |
} |
|
88 |
} |
|
89 |
} |
|
90 |
|
|
91 |
return 'bot_lang_init'; |
|
92 |
?> |