Revision: 10218 http://sourceforge.net/p/languagetool/code/10218 Author: gulp21-1 Date: 2013-06-09 19:12:30 +0000 (Sun, 09 Jun 2013) Log Message: ----------- [extension] respect persdict.dat
Modified Paths: -------------- trunk/extension/common/tests/index.html trunk/extension/firefox/CHANGES trunk/extension/firefox/TODO trunk/extension/firefox/lib/main.js trunk/extension/firefox/locale/en-US.properties trunk/extension/firefox/package.json Added Paths: ----------- trunk/extension/common/tests/persDictTest.html Modified: trunk/extension/common/tests/index.html =================================================================== --- trunk/extension/common/tests/index.html 2013-06-09 14:04:46 UTC (rev 10217) +++ trunk/extension/common/tests/index.html 2013-06-09 19:12:30 UTC (rev 10218) @@ -17,6 +17,7 @@ <span class="fail"><a href="headlineTest.html">headlineTest.html</a></span><br/> <span class="fail"><a href="iframeTest.html">iframeTest.html</a></span><br/> <span class="pass"><a href="newlineTest.html">newlineTest.html</a></span><br/> +<span class="pass"><a href="persDictTest.html">persDictTest.html</a></span><br/> <span class="pass"><a href="quotesTest.html">quotesTest.html</a></span><br/> <span class="fail"><a href="scriptContentsTest.html">scriptContentsTest.html</a></span><br/> <span class="pass"><a href="textFieldTest.html">textFieldTest.html</a></span><br/> Added: trunk/extension/common/tests/persDictTest.html =================================================================== --- trunk/extension/common/tests/persDictTest.html (rev 0) +++ trunk/extension/common/tests/persDictTest.html 2013-06-09 19:12:30 UTC (rev 10218) @@ -0,0 +1,14 @@ +<!DOCTYPE HTML> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<title>persDictTest</title> +</head> +<body> + +Paste your own text here… Or check this text to see a few of the problems that LanguageTool can detecd. This is anonesenseword. + +(up to 2 mistakes) + +</body> +</html> Modified: trunk/extension/firefox/CHANGES =================================================================== --- trunk/extension/firefox/CHANGES 2013-06-09 14:04:46 UTC (rev 10217) +++ trunk/extension/firefox/CHANGES 2013-06-09 19:12:30 UTC (rev 10218) @@ -1,9 +1,14 @@ -0.3 (xx/06/2013, LT 2.2) -- possibility to check text with keyboard shortcut (Ctrl+Shift+L for selections, Ctrl+Shift+Return for text fields) +0.4 (xx/09/2013, LT 2.3) - support for xx has been added to LanguageTool - new translations for xx - updated translations for xx +0.3 (xx/06/2013, LT 2.2) +- possibility to check text with keyboard shortcut (defaults are Ctrl+Shift+L for selections, Ctrl+Shift+Return for text fields) +- words in the personal dictionary are ignored during spell checking +- new translations for xx +- updated translations for xx + 0.2 (23/03/2013, LT 2.1) - possibility to check selection or text field using a context menu item - updated detection of speller rules (esp. German) Modified: trunk/extension/firefox/TODO =================================================================== --- trunk/extension/firefox/TODO 2013-06-09 14:04:46 UTC (rev 10217) +++ trunk/extension/firefox/TODO 2013-06-09 19:12:30 UTC (rev 10218) @@ -22,12 +22,14 @@ selecting the text (e.g. lt forum) - this probably affects all TinyMCE-based editors -- ignore spelling errors in the user's personal dictionary (persdict.dat in the profile directory) - - possibility to (de)activate rules +- possibility to add ingored spelling errors to persdict.dat + - translate the language name shown in the popup +- instant apply new shortcuts + Before releasing: - update translations (-> CHANGES) - update list of supported languages (-> CHANGES) Modified: trunk/extension/firefox/lib/main.js =================================================================== --- trunk/extension/firefox/lib/main.js 2013-06-09 14:04:46 UTC (rev 10217) +++ trunk/extension/firefox/lib/main.js 2013-06-09 19:12:30 UTC (rev 10218) @@ -1,10 +1,12 @@ var cm=require("sdk/context-menu"); +var file=require("sdk/io/file"); var hotkeys=require("sdk/hotkeys"); var panels=require("sdk/panel"); var requests=require("sdk/request"); var selection=require("sdk/selection"); var self=require("sdk/self"); var simpleprefs=require("sdk/simple-prefs"); +var system = require("sdk/system"); var tabs=require("sdk/tabs"); // tabs.open("http://www.languagetool.org/forum/"); var timer=require("sdk/timers"); @@ -15,6 +17,8 @@ var PLEASEWAITWHILECHECKING="<div class=\"status\">"+_("pleaseWaitWhileChecking")+"</div>"; var MAXCONTEXTLENGTH=20; var MAXLENGTHWEBSERVICE=50000; +var PERSDICTFILE=file.join(system.pathFor("ProfD"), "persdict.dat"); +var PERSDICT=file.exists(PERSDICTFILE) ? file.read(PERSDICTFILE,"r").split("\n") : []; var contentString=""; var originalContentStringLength=0; @@ -138,7 +142,12 @@ if(returnText.indexOf("markerGrammar")!=-1) { returnTextGrammar+=returnText; } else { - returnTextSpelling+=returnText; + console.log(m); + console.log(PERSDICT); + console.log(PERSDICT.indexOf(m)); + if(PERSDICT.indexOf(m)==-1) { // ignore spelling mistakes if the word is in personal dictionary + returnTextSpelling+=returnText; + } } } // for each <error/> @@ -314,11 +323,13 @@ }); var checkSelectionHotkey=hotkeys.Hotkey({ - combo: "accel-shift-l", +// combo: "accel-shift-l", + combo: simpleprefs.prefs.hotkeySelection, onPress: function(){widgetClicked();} }); var checkTextareaHotkey=hotkeys.Hotkey({ - combo: "accel-shift-return", +// combo: "accel-shift-return", + combo: simpleprefs.prefs.hotkeyTextarea, onPress: function(){widgetOnClick();} }); Modified: trunk/extension/firefox/locale/en-US.properties =================================================================== --- trunk/extension/firefox/locale/en-US.properties 2013-06-09 14:04:46 UTC (rev 10217) +++ trunk/extension/firefox/locale/en-US.properties 2013-06-09 19:12:30 UTC (rev 10218) @@ -21,6 +21,10 @@ mothertongue_description=Select your mother tongue here in order to be warned of false friends in foreign-language texts. enableSpellCheck_title=Enable spell check ignoreQuotes_title=Ignore lines starting with “>” (i.e. quotes) +hotkeySelection_title=Shortcut for checking selection +hotkeySelection_description=default is accel-shift-l; possible modifiers: accel (control or command on Mac), shift, alt (or option), meta (or command), control; requires restart +hotkeyTextarea_title=Shortcut for checking text area +hotkeyTextarea_description=default is accel-shift-return; possible modifiers: accel (control or command on Mac), shift, alt (or option), meta (or command), control; requires restart localServerUrl_title=URL of the local server localServerUrl_description=You can change the port on which the LanguageTool server is running, or enter a completely different URL, e.g. if you are using a central server in your company. enableWebService_title=Use web service when connecting with the local server is not successful Modified: trunk/extension/firefox/package.json =================================================================== --- trunk/extension/firefox/package.json 2013-06-09 14:04:46 UTC (rev 10217) +++ trunk/extension/firefox/package.json 2013-06-09 19:12:30 UTC (rev 10218) @@ -8,6 +8,7 @@ "id": "jid1-j3KiX1n7UXrjxQ", "description": "LanguageTool for Firefox", "homepage": "http://languagetool.org", + "permissions": {"private-browsing": true}, "__comment": "That should be ok, no data is sent to a foreign server unless explicitly allowed by the users", "preferences": [{ "name": "autodetect", "title": "autodetect_title", @@ -350,6 +351,18 @@ "type": "bool", "value": true }, { + "name": "hotkeySelection", + "title": "hotkeySelection_title", + "description": "hotkeySelection_description", + "type": "string", + "value": "accel-shift-l" + }, { + "name": "hotkeyTextarea", + "title": "hotkeyTextarea_title", + "description": "hotkeyTextarea_description", + "type": "string", + "value": "accel-shift-return" + }, { "name": "localServerUrl", "title": "localServerUrl_title", "description": "localServerUrl_description", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. A cloud service to automate IT design, transition and operations 2. Dashboards that offer high-level views of enterprise services 3. A single system of record for all IT processes http://p.sf.net/sfu/servicenow-d2d-j _______________________________________________ Languagetool-commits mailing list Languagetool-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/languagetool-commits