7 * Copyright (c) 1999-2002 The SquirrelMail development team
8 * Licensed under the GNU GPL. For full terms see the file COPYING.
10 * This module changes the international dictionaries selection
11 * for the user. Called after LANG_SETUP module.
15 * @author Konstantin Riabitsev <icon@duke.edu> ($Author$)
19 global $use_langs, $lang_default, $SQSPELL_APP_DEFAULT;
20 $words = sqspell_getWords();
22 $words = sqspell_makeDummy();
24 $langs = sqspell_getSettings($words);
25 if (sizeof($use_langs)){
27 * See if the user clicked any options on the previous page.
29 if (sizeof($use_langs)>1){
31 * See if s/he wants more than one dictionary.
33 if ($use_langs[0]!=$lang_default){
35 * See if we need to juggle the order of the dictionaries
36 * to make the default dictionary first in line.
38 if (in_array($lang_default, $use_langs)){
40 * See if the user was dumb and chose a default dictionary
41 * to be something other than the ones he selected.
43 $hold = array_shift($use_langs);
44 $lang_string = join(", ", $use_langs);
45 $lang_string = str_replace("$lang_default", "$hold", $lang_string);
46 $lang_string = $lang_default . ", " . $lang_string;
51 $lang_string = join(', ', $use_langs);
55 * No need to juggle the order -- preferred is already first.
57 $lang_string = join(', ', $use_langs);
61 * Just one dictionary, please.
63 $lang_string = $use_langs[0];
65 $lang_array = explode( ',', $lang_string );
67 foreach( $lang_array as $a) {
68 $dsp_string .= _(trim($a)) . ', ';
70 $dsp_string = substr( $dsp_string, 0, -2 );
72 . sprintf(_("Settings adjusted to: <strong>%s</strong> with <strong>%s</strong> as default dictionary."), $dsp_string, _($lang_default))
76 * No dictionaries selected. Use system default.
79 . sprintf(_("Using <strong>%s</strong> dictionary (system default) for spellcheck." ), $SQSPELL_APP_DEFAULT)
81 $lang_string = $SQSPELL_APP_DEFAULT;
83 $old_lang_string = join(", ", $langs);
84 $words = str_replace("# LANG: $old_lang_string", "# LANG: $lang_string",
87 * Write it down where the sun don't shine.
89 sqspell_writeWords($words);
90 sqspell_makePage(_("International Dictionaries Preferences Updated"),