summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-04-19 11:59:06 +0000
committeralecpl <alec@alec.pl>2010-04-19 11:59:06 +0000
commitc287f34bd37427f81d6e7a7e0604e998554348be (patch)
tree7924672dae3ed1ebcfb14a5a557e8f63562e827c
parent8fa9229d578a9c2f265b4e46278c3f5f4329baae (diff)
- Fix setting spellcheck languages with extended codes (#1486605)
-rw-r--r--CHANGELOG1
-rw-r--r--program/steps/mail/compose.inc30
2 files changed, 26 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 0f3c1d033..fdfaf29fc 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG RoundCube Webmail
===========================
+- Fix setting spellcheck languages with extended codes (#1486605)
- Fix messages list scrolling in FF3.6 (#1486472)
- Fix quicksearch input focus (#1486637)
- Always set changed date when flagging a DB record as deleted + provide a cleanup script
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 2fac294af..bc7cd8960 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -522,16 +522,36 @@ function rcmail_compose_body($attrib)
// include GoogieSpell
if (!empty($CONFIG['enable_spellcheck'])) {
- $lang = strtolower(substr($_SESSION['language'], 0, 2));
-
- $spellcheck_langs = (array)$RCMAIL->config->get('spellcheck_languages', array('da'=>'Dansk', 'de'=>'Deutsch', 'en' => 'English', 'es'=>'Español', 'fr'=>'Français', 'it'=>'Italiano', 'nl'=>'Nederlands', 'pl'=>'Polski', 'pt'=>'Português', 'fi'=>'Suomi', 'sv'=>'Svenska'));
+ $engine = $RCMAIL->config->get('spellcheck_engine','googie');
+ $spellcheck_langs = (array) $RCMAIL->config->get('spellcheck_languages',
+ array('da'=>'Dansk', 'de'=>'Deutsch', 'en' => 'English', 'es'=>'Español',
+ 'fr'=>'Français', 'it'=>'Italiano', 'nl'=>'Nederlands', 'pl'=>'Polski',
+ 'pt'=>'Português', 'fi'=>'Suomi', 'sv'=>'Svenska'));
+
+ // googie works only with two-letter codes
+ if ($engine == 'googie') {
+ $lang = strtolower(substr($_SESSION['language'], 0, 2));
+
+ $spellcheck_langs_googie = array();
+ foreach ($spellcheck_langs as $key => $name)
+ $spellcheck_langs_googie[strtolower(substr($key,0,2))] = $name;
+ $spellcheck_langs = $spellcheck_langs_googie;
+ }
+ else {
+ $lang = $_SESSION['language'];
+
+ // if not found in the list, try with two-letter code
+ if (!$spellcheck_langs[$lang])
+ $lang = strtolower(substr($lang, 0, 2));
+ }
+
if (!$spellcheck_langs[$lang])
$lang = 'en';
-
+
$editor_lang_set = array();
foreach ($spellcheck_langs as $key => $name) {
$editor_lang_set[] = ($key == $lang ? '+' : '') . JQ($name).'='.JQ($key);
- }
+ }
$OUTPUT->include_script('googiespell.js');
$OUTPUT->add_script(sprintf(