849bdf42 |
1 | <?php |
4b4abf93 |
2 | |
d112ed5a |
3 | /** |
4 | * lang_change.mod |
d112ed5a |
5 | * |
4b4abf93 |
6 | * Squirrelspell module |
d112ed5a |
7 | * |
8 | * This module changes the international dictionaries selection |
91e0dccc |
9 | * for the user. Called after LANG_SETUP module. |
d112ed5a |
10 | * |
4b4abf93 |
11 | * @author Konstantin Riabitsev <icon at duke.edu> |
d4e46166 |
12 | * @copyright © 1999-2009 The SquirrelMail Project Team |
4b4abf93 |
13 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
44d661aa |
14 | * @version $Id$ |
15 | * @package plugins |
16 | * @subpackage squirrelspell |
d112ed5a |
17 | */ |
2b5a7157 |
18 | |
d8aa9efe |
19 | global $SQSPELL_APP_DEFAULT; |
20 | |
7996c920 |
21 | if (! sqgetGlobalVar('use_langs',$use_langs,SQ_POST)) { |
22 | $use_langs = array($SQSPELL_APP_DEFAULT); |
23 | } |
d8aa9efe |
24 | |
7996c920 |
25 | if (! sqgetGlobalVar('lang_default',$lang_default,SQ_POST)) { |
26 | $lang_default = $SQSPELL_APP_DEFAULT; |
d112ed5a |
27 | } |
7996c920 |
28 | |
29 | /** |
30 | * Rebuild languages. Default language is first one. |
31 | */ |
32 | $new_langs = array($lang_default); |
33 | foreach ($use_langs as $lang) { |
34 | if (! in_array($lang,$new_langs)) { |
773d8dcd |
35 | $new_langs[]=$lang; |
849bdf42 |
36 | } |
7996c920 |
37 | } |
38 | |
39 | if (sizeof($new_langs)>1) { |
d112ed5a |
40 | $dsp_string = ''; |
7996c920 |
41 | foreach( $new_langs as $a) { |
efb2f459 |
42 | $dsp_string .= _(htmlspecialchars(trim($a))) . _(", "); |
d112ed5a |
43 | } |
7996c920 |
44 | // remove last comma and space |
d112ed5a |
45 | $dsp_string = substr( $dsp_string, 0, -2 ); |
7996c920 |
46 | |
b986936a |
47 | // i18n: first %s is comma separated list of languages, second %s - default language. |
48 | // Language names are translated, if they are present in squirrelmail.po file. |
49 | // make sure that you don't use html codes in language name translations |
d112ed5a |
50 | $msg = '<p>' |
7996c920 |
51 | . sprintf(_("Settings adjusted to: %s with %s as default dictionary."), |
52 | '<strong>'.htmlspecialchars($dsp_string).'</strong>', |
53 | '<strong>'.htmlspecialchars(_($lang_default)).'</strong>') |
d112ed5a |
54 | . '</p>'; |
55 | } else { |
56 | /** |
7996c920 |
57 | * Only one dictionary is selected. |
d112ed5a |
58 | */ |
59 | $msg = '<p>' |
7996c920 |
60 | . sprintf(_("Using %s dictionary for spellcheck." ), '<strong>'.htmlspecialchars(_($new_langs[0])).'</strong>') |
d112ed5a |
61 | . '</p>'; |
d112ed5a |
62 | } |
7996c920 |
63 | |
64 | /** save settings */ |
65 | sqspell_saveSettings($new_langs); |
66 | |
91e0dccc |
67 | sqspell_makePage(_("International Dictionaries Preferences Updated"), |
90ad8cd1 |
68 | null, $msg); |
d112ed5a |
69 | |
70 | /** |
71 | * For Emacs weenies: |
72 | * Local variables: |
73 | * mode: php |
74 | * End: |
2b6b400e |
75 | * vim: syntax=php |
d112ed5a |
76 | */ |