# [SublimeText3 SwitchDictionary](https://github.com/Naereen/SublimeText3_SwitchDictionary/) - EARLY STAGE ## WARNING [This plug-in](https://github.com/Naereen/SublimeText3_SwitchDictionary/) [is still in active development](https://github.com/Naereen/SublimeText3_SwitchDictionary/graphs/commit-activity) and is in early stage! [![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) [![made-for-st3](https://img.shields.io/badge/Made%20for-SublimeText3-green.svg)](https://www.sublimetext.com/3dev) [![Package Control total downloads](https://img.shields.io/packagecontrol/dt/SwitchDictionary.svg)](https://packagecontrol.io/packages/SwitchDictionary) [![Package Control month downloads](https://img.shields.io/packagecontrol/dm/SwitchDictionary.svg)](https://packagecontrol.io/packages/SwitchDictionary) [![Package Control week downloads](https://img.shields.io/packagecontrol/dw/SwitchDictionary.svg)](https://packagecontrol.io/packages/SwitchDictionary) [![Package Control day downloads](https://img.shields.io/packagecontrol/dd/SwitchDictionary.svg)](https://packagecontrol.io/packages/SwitchDictionary) ## About It is a tiny [Sublime Text 3](https://www.sublimetext.com/3) plug-in (not tested on [ST 2](https://www.sublimetext.com/)), that add commands and shortcuts to switch between: no spell-check, spell-check for *French*, and spell-check for *English*. This plugin also implements a small automatic language checker to detect if the document is in French or in English (and [embeds](https://github.com/Naereen/SublimeText3_SwitchDictionary/tree/master/langdetect/) a more sophisticated one), but the dictionary is loaded only with a keyboard shortcut, it is *not* turned on automatically. *Note:* It is restricted to only French vs English for now. I hope it will soon be better, allowing you to define your own list of dictionaries. ## Demo (gif screencast) ![demo of Sublime Text 3 'SwitchDictionary' plugin (gif)](https://raw.githubusercontent.com/Naereen/SublimeText3_SwitchDictionary/master/demo_SublimeText3_SwitchDictionary_plugin.gif) ---- ## Commands ### `enable_english_spellcheck` - It enables spell-check, and sets the dictionary to *English* - [It is associated](Default.sublime-keymap) to the key chain ctrl+k, ctrl+e ### `enable_french_spellcheck` - It enables spell-check, and sets the dictionary to *French* - [It is associated](Default.sublime-keymap) to the key chain ctrl+k, ctrl+f ### `switch_spellcheck` - It cycles between *English*, *French*, and *None* - [It is associated](Default.sublime-keymap) to the key chain ctrl+k, ctrl+s and also to ctrl+alt+s (*s* for *switch*) ### `auto_switch_spellcheck` - It uses [`langdetect.detect`](https://github.com/Mimino666/langdetect) to (try to) automatically detect the language of the current file. I also [manually added](https://github.com/Naereen/SublimeText3_SwitchDictionary/commit/cdaeccee0e15f37d2303db4c55aee66ceb6187b2) a small check (with French accents), as `langdetect` is failing on some very small files - Right now, the detected language is **only** used to know if it is French / or not French (English or other language). TODO I need to generalize this - It sets to *French* if the file is in French (or as a high probability of being written in French), and sets to *English* otherwise - [It is associated](Default.sublime-keymap) to ctrl+alt+a (*a* for *auto*) - Warning: it requires the current file (edited file) to be saved on the disk, as it uses the content of the file to [guess the language](https://github.com/Mimino666/langdetect#basic-usage) ### `disable_spellcheck` - It simply disables the spell-check - It is NOT associated to any key (*tip:* use the default command, associated to F6 by default) ---- ## Accessing commands through... ### :notebook: The *Command Palette* ! Press ctrl+shift+p (Windows, Linux) or cmd+shift+p (OS X) to open the [*Command Palette*](SwitchDictionary.sublime-commands), and then search for: - `Switch Dictionary: disable (None)`, - `Switch Dictionary: to English`, - `Switch Dictionary: to French`, - `Switch Dictionary: None ↔ French ↔ English`. - `Auto Switch Dictionary (guess)`. ### :mouse: The *Encoding Menu* ! In the status bar, you should have a menu showing the encoding of the current file (by default it is `UTF-8`). Click on [the menu](Encoding.sublime-menu), and you can *click* on: - `Switch Dictionary – Disable (None)` - `Switch Dictionary – to English` - `Switch Dictionary – to French` - `Switch Dictionary – None ↔ French ↔ English` - `Auto Switch Dictionary (guess)` ### :musical_keyboard: *Shortcuts* ! [By default](Default.sublime-keymap), the following shortcuts are available - ctrl+k, ctrl+e : `Switch Dictionary – to English` - ctrl+k, ctrl+f : `Switch Dictionary – to French` - ctrl+k, ctrl+s or ctrl+alt+s : `Switch Dictionary – None ↔ French ↔ English` - ctrl+alt+a : `Auto Switch Dictionary (guess)` ---- ## :question: How to install it ? ### :ok_hand: With [Package Control](https://packagecontrol.io/) If you have [Package Control](https://packagecontrol.io/) installed in Sublime Text 2/3, just press ctrl+shift+p (Windows, Linux) or cmd+shift+p (OS X) to open the *Command Palette*. 1. Start typing `install` to select `Package Control: Install Package`, 2. Then search for `SwitchDictionary` and select it. That's it! The package is now available [on packagecontrol.io](https://packagecontrol.io/packages/SwitchDictionary) ! [![Package Control total downloads](https://img.shields.io/packagecontrol/dt/SwitchDictionary.svg)](https://packagecontrol.io/packages/SwitchDictionary) [![Package Control month downloads](https://img.shields.io/packagecontrol/dm/SwitchDictionary.svg)](https://packagecontrol.io/packages/SwitchDictionary) [![Package Control week downloads](https://img.shields.io/packagecontrol/dw/SwitchDictionary.svg)](https://packagecontrol.io/packages/SwitchDictionary) [![Package Control day downloads](https://img.shields.io/packagecontrol/dd/SwitchDictionary.svg)](https://packagecontrol.io/packages/SwitchDictionary) ### :floppy_disk: Manually, with [git](https://git-scm.com/) You can also install this package manually by entering the Packages directory of Sublime Text 3 (through the menu: "Preferences" > "Browse packages"), and issuing this command on a terminal: ```bash cd ~/.config/sublime-text-3/Packages/ # adapt the path on Windows or Mac OS X git clone https://github.com/Naereen/SublimeText3_SwitchDictionary ``` ### Check it You can check it was well installed by hitting ctrl+k, ctrl+s (it should enable English spell checking). ---- ## :boom: [TODO !](https://github.com/Naereen/SublimeText3_SwitchDictionary/projects/1) - [x] Test it on another laptop : DONE on another Linux laptop - [x] Test it on Mac OS X : DONE on a Mac OS laptop, TODO on Windows - [x] Implement a smart detection, to know if a file is in French or in English - [ ] Be more general, allow a user to define his own favorite dictionaries - [ ] Finish it completely - [ ] Include a second screencast showing the "automatic language detection" feature (new in [v0.0.3](https://github.com/Naereen/SublimeText3_SwitchDictionary/releases/tag/v0.0.3)) - [x] Publish it on [Package Control](https://packagecontrol.io/), OK. I was waiting for [this pull request](https://github.com/wbond/package_control_channel/pull/5867) to be merged. ## :hourglass: [Future Features](https://github.com/Naereen/SublimeText3_SwitchDictionary/projects/1) - Be more general: allow users to define manually a list of dictionary (path, and name), and add one command for each dictionary, and make the `switch_spellcheck` command cycle between them! ---- ## :scroll: License ? [![GitHub license](https://img.shields.io/github/license/Naereen/SublimeText3_SwitchDictionary.svg)](https://github.com/Naereen/SublimeText3_SwitchDictionary/blob/master/LICENSE) This plug-in is published under the terms of the [MIT license](http://lbesson.mit-license.org/) (file [LICENSE.txt](LICENSE.txt)), © [Lilian Besson](https://GitHub.com/Naereen), 2016. [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/Naereen/SublimeText3_SwitchDictionary/graphs/commit-activity) [![Ask Me Anything !](https://img.shields.io/badge/Ask%20me-anything-1abc9c.svg)](https://GitHub.com/Naereen/ama) [![Analytics](https://ga-beacon.appspot.com/UA-38514290-17/github.com/Naereen/SublimeText3_SwitchDictionary/README.md?pixel)](https://GitHub.com/Naereen/SublimeText3_SwitchDictionary/) [![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) [![made-for-st3](https://img.shields.io/badge/Made%20for-SublimeText3-green.svg)](https://www.sublimetext.com/3dev) [![ForTheBadge uses-badges](http://ForTheBadge.com/images/badges/uses-badges.svg)](http://ForTheBadge.com) [![ForTheBadge uses-git](http://ForTheBadge.com/images/badges/uses-git.svg)](https://GitHub.com/) [![ForTheBadge built-with-love](http://ForTheBadge.com/images/badges/built-with-love.svg)](https://GitHub.com/Naereen/)