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