bug 95541, r=cmanske, sr=kin, Enable multiple spellcheckers in mail/composer
This commit is contained in:
Родитель
797b117100
Коммит
b36fc76f1a
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
orient="vertical">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://editor/content/EdDialogCommon.js"/>
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/utilityOverlay.js"/>
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/builtinURLs.js"/>
|
||||
<script type="application/x-javascript" src="chrome://editor/content/EdSpellCheck.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/strres.js" />
|
||||
|
||||
|
@ -104,8 +106,13 @@
|
|||
<spacer/>
|
||||
</row>
|
||||
<row>
|
||||
<menulist id="LanguageMenulist" oncommand="SelectLanguage()"/>
|
||||
<!-- contents are appended by JS -->
|
||||
<menulist id="LanguageMenulist" class="small-margin" oncommand="SelectLanguage()">
|
||||
<menupopup>
|
||||
<menuitem value="more-cmd" label="&moreDictionaries.label;"/>
|
||||
<menuseparator/>
|
||||
<!-- dynamic content populated by JS -->
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<hbox flex="1">
|
||||
<button class="dialog spell-check" id="Recheck" label="&recheckButton.label;" oncommand="Recheck()"/>
|
||||
<button class="dialog spell-check" id="Close" label="&closeButton.label;" oncommand="onClose()"/>
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
<!ENTITY changeAllButton.label "Change All">
|
||||
|
||||
<!ENTITY userDictionary.label "User Dictionary:">
|
||||
<!ENTITY moreDictionaries.label "Download More">
|
||||
<!ENTITY addToUserDictionaryButton.label "Add Word">
|
||||
<!ENTITY editUserDictionaryButton.label "Edit...">
|
||||
<!ENTITY recheckButton.label "Recheck">
|
||||
|
|
Загрузка…
Ссылка в новой задаче