phpDocumentor updates
[squirrelmail.git] / plugins / squirrelspell / modules / lang_change.mod
CommitLineData
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>
12 * @copyright &copy; 1999-2005 The SquirrelMail Project Team
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 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) {
a6d3eff6 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
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"),
90ad8cd1 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?>