Only grab comments marked i18n to the template.
[squirrelmail.git] / plugins / squirrelspell / modules / lang_change.mod
... / ...
CommitLineData
1<?php
2
3/**
4 * lang_change.mod
5 *
6 * Squirrelspell module
7 *
8 * This module changes the international dictionaries selection
9 * for the user. Called after LANG_SETUP module.
10 *
11 * @author Konstantin Riabitsev <icon at duke.edu>
12 * @copyright &copy; 1999-2006 The SquirrelMail Project Team
13 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
14 * @version $Id$
15 * @package plugins
16 * @subpackage squirrelspell
17 */
18
19global $SQSPELL_APP_DEFAULT;
20
21if (! sqgetGlobalVar('use_langs',$use_langs,SQ_POST)) {
22 $use_langs = array($SQSPELL_APP_DEFAULT);
23}
24
25if (! sqgetGlobalVar('lang_default',$lang_default,SQ_POST)) {
26 $lang_default = $SQSPELL_APP_DEFAULT;
27}
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)) {
35 $new_langs[]=$lang;
36 }
37}
38
39if (sizeof($new_langs)>1) {
40 $dsp_string = '';
41 foreach( $new_langs as $a) {
42 $dsp_string .= _(htmlspecialchars(trim($a))) . _(", ");
43 }
44 // remove last comma and space
45 $dsp_string = substr( $dsp_string, 0, -2 );
46
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
50 $msg = '<p>'
51 . sprintf(_("Settings adjusted to: %s with %s as default dictionary."),
52 '<strong>'.htmlspecialchars($dsp_string).'</strong>',
53 '<strong>'.htmlspecialchars(_($lang_default)).'</strong>')
54 . '</p>';
55} else {
56 /**
57 * Only one dictionary is selected.
58 */
59 $msg = '<p>'
60 . sprintf(_("Using %s dictionary for spellcheck." ), '<strong>'.htmlspecialchars(_($new_langs[0])).'</strong>')
61 . '</p>';
62}
63
64/** save settings */
65sqspell_saveSettings($new_langs);
66
67sqspell_makePage(_("International Dictionaries Preferences Updated"),
68 null, $msg);
69
70/**
71 * For Emacs weenies:
72 * Local variables:
73 * mode: php
74 * End:
75 * vim: syntax=php
76 */