Dictionary Switcher 1.0 - It would be nice if the padding to the Left & Right of the StatusBar wording was not so large. My other Extension all seem to be around 10px.
FF3.5.5 - Mac OS 10.5.8
Theme - Mostly Crystal 3.5.1 (modified for Mac OS)
Other StatusBar Ext - FlagFox, FoxClocks, QuickPageZoom
Johan Walles wrote on December 8, 2009 12:52 PM GMT ():
1.0 works very sporadically on Mozilla/5.0 (X11; U; Linux i686; sv-SE; rv:1.9.0.15) Gecko/2009102815 Ubuntu/9.04 (jaunty) Firefox/3.0.15.
Having responses to this e-mailed to johan.walles@gmail.com would be great!
Try this:
* Open GMail (Swedish UI in case that matters).
* Start composing a new e-mail.
* Write a sentence in Swedish in the mail-text field (I tried “Det här är kungens svenska”).
* My status bar says: “auto: en-AU” (Swedish expected).
* Switch to a new tab and back.
* My status bar now says “auto: sv”. Seems correct, but why did I have to switch tabs?
* Press an arrow key to move the cursor. The status bar changes to “auto: en_US”. Expected Swedish.
Enabled options:
“Detect dictionary as I type”
“Ställ in språk automatiskt” (set language automatically).
Disabled options:
“Kom ihåg vald ordlista för denna webbplats” (remember selected dictionary for this web site).
It would be a nice feature if the add-on would take less space in your status bar by displaying a flag for the current language it’s using. When using auto-detect it shouldn’t display it but just show the flag.
Szabolcs wrote on February 1, 2010 02:32 PM GMT ():
Hello,
Have you considered adding an option to use Google’s language detection API for better accuracy and performance? This obviously has drawbacks and cannot work in all situations (and might even require manually setting the preferred dictionary for each language), but I think it’ll work in the majority of cases. And when it works, it might actually work better than the current way.
Problems with the current method are bad performance (occasional hangs) and very low accuracy when many dictionaries are installed. For example, while typing five relatively long sentences in Hungarian in Gmail, it started out with en-US, then kept switching back and forth between the British and the Greek-English combined dictionaries. But not once did it switch to the Hungarian one.
When writing a new email in Czech in GMail, and after having about 2 lines written, this addon incorrectly switches to en-US which is weird because in cs_CZ, there are almost none red squiggly lines while after the switch, my text goes all red. The only options selected is “Detect dictionary as I type”, the other two are unchecked. Is this a known issue?
One issue I have observed: I have American (en-US), Australian (en-AU) and British (en-UK) dictionaries installed. Pages that only specify English (en) default to the first (alphabetically) dictionary, namely Australian. It would be preferable to have a default dictionary in such cases, or go by the “accept-language” preference in the browser.
Klasse AddOn!
Aber es wäre echt richtig klasse, wenn man die Einstellung vornehmen könnte welche Sprachen zur Auswahl stehen sollen. Bisher ist es ja die einzige Möglich die switch.js zu editieren. Eine Option wäre echt super. Denn unter Linux sind auch öfter mal ganze Sprachpakete installiert mit 20 Englisch Wörterbüchern aus sämtlichen Ländern. Da wäre soetwas doch ganz hilfreich.
Hi,
cool extension long time I was looking for it. Is there a way to remove the statusbar “icon” and use the toolbar button only ? Maybe by adding some entry to about:config ??
1.0.1 doesn’t recognize finnish dictionary as installed. I can change it with right click -> languages -> finnish / Finland. But the right click menu of DS only recognizes en-US
Thanks for this excellent and really useful extension.
One thing which I would really wish for is a hotkey to switch between languages. This way I could change the language while I am writing a text with just a keystroke without having to take my hands of the keyboard (to the mouse).
First of all, thanks for this nice addon.
I’m using a patched version of your addon so I thought I should probably share my changes.
1. I don’t fully understand the idea behind the text.length distinction (line 180 in switch.js), in any case I think that a substring(0,15) might leave the last word crippled in many cases, i.e., misspelled in any language. So I did a
- if (text.length == 10) {
- text = text.replace(/[^\w\x80-\x9F\xA2-\xA4\xC0-\xD6\xD8-\xF6\xF9-\xFF]+/ig, “ ”).replace(/^ /,“”).replace(/ $/,“”).split(“ ”);
- if (text.length < 3)
- return;
- } else if (text.length > 15 && node != this._textarea) {
- text = text.replace(/[^\w\x80-\x9F\xA2-\xA4\xC0-\xD6\xD8-\xF6\xF9-\xFF]+/ig, “ ”).replace(/^ /,“”).substring(0, 15).replace(/ $/,“”).split(“ ”);
- } else {
- return;
- }
+ text = text.replace(/[^\w\x80-\x9F\xA2-\xA4\xC0-\xD6\xD8-\xF6\xF9-\xFF]+/ig, “ ”).replace(/^ /,“”).replace(/ $/,“”).split(“ ”);
+ if (text.length == 0)
+ return;
and
- for (let i = 0; i < text.length; i++)
+ for (let i = 0; i < text.length && i < 25; i++)
2. I changed the keyPress function somewhat to keep the load on every key press low. I’m not a javascript expert, so maybe this implementation is not really wise:
this._keyPress = function (e) {
- obj.keyPress(e);
+ if (obj._timeout)
+ clearTimeout(obj._timeout);
+ obj._timeout = setTimeout(function (){ obj.keyPress(e); }, 1000);
};
3. Code similar to what was already present to make sure that we don’t check the same stuff twice:
+ if (this._textarea == node && this._oldText == text)
+ return;
this._textarea = node;
+ this._oldText = text;
4. A small speedup
- if (sc.spellChecker.CheckCurrentWord(text[i]))
+ if (sc.spellChecker.CheckCurrentWordNoSuggest(text[i]))
5. I think the old code has a bug that happens if you have more than two dictionaries installed. Suppose you have dictionaries A, B, C (in that order) and a text which has 3,2,1 spelling errors, respectively. The old code will imho select ’B’. The following patch should fix the selection process:
- var maxMisspelled = Math.round(text.length / 4);
var initialDict = sc.spellChecker.GetCurrentDictionary(), dict = initialDict;
- var misspelled, oldMisspelled, newDict;
+ var misspelled, oldMisspelled = text.length+1, newDict = initialDict;
do {
misspelled = 0;
- if (dict != initialDict)
- sc.spellChecker.SetCurrentDictionary(dict);
+ sc.spellChecker.SetCurrentDictionary(dict);
for (let i = 0; i < text.length && i < 25; i++)
if (sc.spellChecker.CheckCurrentWordNoSuggest(text[i]))
misspelled++;
- if (!newDict || misspelled < oldMisspelled)
+ if (misspelled < oldMisspelled){
newDict = dict;
- oldMisspelled = misspelled;
+ oldMisspelled = misspelled;
+ }
dict = this.getNextInList(dict);
- } while (misspelled > maxMisspelled && dict != initialDict);
+ } while (dict != initialDict);
All these changes have not been tested thoroughly so use them at own risk.
If you have any remarks, contact me by email please (julian DOT rueth AT gmail).
julian