From 6a6ab4e28f4ad5ee6a0dcb4fcdb6d1fb192e988e Mon Sep 17 00:00:00 2001 From: "loadrunner%betak.net" Date: Thu, 20 Sep 2001 04:31:53 +0000 Subject: [PATCH] bug 97541, Enable multiple spellcheckers in mail/composer, r=cmanske, sr=kin, PDT+ git-svn-id: svn://10.0.0.236/branches/MOZILLA_0_9_4_BRANCH@103272 18797224-902f-48f8-a5cc-f745e15eee43 --- .../composer/locale/en-US/editor.properties | 5 +++ .../editor/ui/dialogs/content/EdSpellCheck.js | 43 ++++++++++++------- .../ui/dialogs/content/EdSpellCheck.xul | 11 ++++- .../dialogs/locale/en-US/EditorSpellCheck.dtd | 1 + 4 files changed, 42 insertions(+), 18 deletions(-) diff --git a/mozilla/editor/ui/composer/locale/en-US/editor.properties b/mozilla/editor/ui/composer/locale/en-US/editor.properties index d8fa52ea3bf..91abb0b3773 100644 --- a/mozilla/editor/ui/composer/locale/en-US/editor.properties +++ b/mozilla/editor/ui/composer/locale/en-US/editor.properties @@ -164,3 +164,8 @@ NoAltText=It is recommended that you supply alternate text that will appear in t SaveImageAs=Save Image (%NAME%)... NoSeparatorCharacter=Please enter a single character to use for separating into columns Apply=Apply +# +# LOCALIZATION NOTE please do not translate %brand%, it will be used programmatically +# download spelling dictionaries confirmation dialog +DictDownldConfirmTit=Download Dictionaries +DictDownldConfirmMsg=%brand% will close the current window and redirect you to a spellchecker download site. diff --git a/mozilla/editor/ui/dialogs/content/EdSpellCheck.js b/mozilla/editor/ui/dialogs/content/EdSpellCheck.js index 10d5ea0ab85..d35fc727450 100644 --- a/mozilla/editor/ui/dialogs/content/EdSpellCheck.js +++ b/mozilla/editor/ui/dialogs/content/EdSpellCheck.js @@ -107,7 +107,6 @@ function Startup() function InitLanguageMenu(curLang) { - ClearMenulist(dialog.LanguageMenulist); var o1 = {}; var o2 = {}; @@ -130,10 +129,10 @@ function InitLanguageMenu(curLang) var languageBundle; var regionBundle; - var menuStr; var menuStr2; var isoStrArray; var defaultIndex = 0; + var langId; // Try to load the language string bundle. @@ -157,32 +156,42 @@ function InitLanguageMenu(curLang) for (var i = 0; i < dictList.length; i++) { try { + langId = dictList[i]; isoStrArray = dictList[i].split("-"); - if (languageBundle && isoStrArray[0]) - menuStr = languageBundle.GetStringFromName(isoStrArray[0].toLowerCase()); + dictList[i] = new Array(2); // first subarray element - pretty name + dictList[i][1] = langId; // second subarray element - language ID - if (regionBundle && menuStr && isoStrArray.length > 1 && isoStrArray[1]) + if (languageBundle && isoStrArray[0]) + dictList[i][0] = languageBundle.GetStringFromName(isoStrArray[0].toLowerCase()); + + if (regionBundle && dictList[i][0] && isoStrArray.length > 1 && isoStrArray[1]) { menuStr2 = regionBundle.GetStringFromName(isoStrArray[1].toLowerCase()); if (menuStr2) - menuStr = menuStr + "/" + menuStr2; + dictList[i][0] = dictList[i][0] + "/" + menuStr2; } - if (!menuStr) - menuStr = dictList[i]; + if (!dictList[i][0]) + dictList[i][0] = dictList[i][1]; } catch (ex) { // GetStringFromName throws an exception when // a key is not found in the bundle. In that // case, just use the original dictList string. - menuStr = dictList[i]; + dictList[i][0] = dictList[i][1]; } + } + + // note this is not locale-aware collation, just simple ASCII-based sorting + // we really need to add loacel-aware JS collation, see bug XXXXX + dictList.sort(); - if (curLang && dictList[i] == curLang) - defaultIndex = i; - - AppendLabelAndValueToMenulist(dialog.LanguageMenulist, menuStr, dictList[i]); + for (var i = 0; i < dictList.length; i++) + { + AppendLabelAndValueToMenulist(dialog.LanguageMenulist, dictList[i][0], dictList[i][1]); + if (curLang && dictList[i][1] == curLang) + defaultIndex = i+2; //first two items are pre-populated and fixed } // Now make sure the correct item in the menu list is selected. @@ -386,10 +395,12 @@ function EditDictionary() function SelectLanguage() { - var item = dialog.LanguageMenulist.selectedItem; - try { - spellChecker.SetCurrentDictionary(item.value); + var item = dialog.LanguageMenulist.selectedItem; + if (item.value != "more-cmd") + spellChecker.SetCurrentDictionary(item.value); + else + window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no,modal", xlateURL('urn:clienturl:composer:spellcheckers')); } catch (ex) { dump(ex); } diff --git a/mozilla/editor/ui/dialogs/content/EdSpellCheck.xul b/mozilla/editor/ui/dialogs/content/EdSpellCheck.xul index 72e74607042..42df938822d 100644 --- a/mozilla/editor/ui/dialogs/content/EdSpellCheck.xul +++ b/mozilla/editor/ui/dialogs/content/EdSpellCheck.xul @@ -35,6 +35,8 @@ orient="vertical">