Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Add a way to choose the current language #21

Closed
jdhoek opened this issue May 22, 2014 · 32 comments
Closed

Add a way to choose the current language #21

jdhoek opened this issue May 22, 2014 · 32 comments

Comments

@jdhoek
Copy link

jdhoek commented May 22, 2014

When you're a software developer and your native language is not English, chances are that you will be switching a lot between English and your native language. I would like to be able to choose the language from my available spell check dictionaries.

The current workaround is to change the system dictionary, but that is cumbersome and most of the time I only want to change the language for the application I am working in at that moment.

On GNU/Linux graphical desktop environments applications that work with text all provide a way to either set the language of the text (Libre/OpenOffice) or to select the current language (Gedit, web browsers, etc.).

Firefox does this very nicely for example:

switch_language

Can we get this functionality in Atom? On GNU/Linux (I don't know about Windows, does it use Hunspell as well?) changing the user's locale is the only way to change the default dictionary language. This means that Atom's spell check is basically stuck in one language, even though multiple dictionaries are available.

It looks like https://github.com/atom/node-spellchecker provides an OS-agnostic interface for spell-checking (using either Hunspell or the system spell checker if you are using Mac OS X). Perhaps it is possible to add a call for a list of available languages as well?

@jdhoek
Copy link
Author

jdhoek commented May 22, 2014

Related to #11.

@Bengt
Copy link

Bengt commented Oct 30, 2014

IMHO, language selection is bad. Many people write texts in their native language and document their programs in English. Thus one needs to switch the language regularly, which is tedious. For example as a German native speaker who also writes a lot of text in English (like this post) I have given up on reconfiguring the spell checking language In Chrome. I brought that up before in #25.

@jdhoek
Copy link
Author

jdhoek commented Oct 30, 2014

@Bengt
Detecting languages automatically is quite error prone, especially in a programming context. The user is the only one who can reliably indicate which language should be the primary target of the spell-checker.

In multi-language documents, being able to use the spell-checker on all languages at once is certainly a nice-to-have feature, but not relevant to this issue, which is that there is currently no way to switch languages from within the editor.

@Bengt
Copy link

Bengt commented Oct 30, 2014

Detecting languages automatically is quite error prone, especially in a programming context.

Do you have anything to support that? My impression is that it is quite feasible. Especially, LangID claims to be robust against text being mixed with programming language syntax.

The user is the only one who can reliably indicate which language should be the primary target of the spell-checker.

In my experience, users do not follow language guidelines strictly, even if they set them themselves. For example some people comment code in multiple languages in the same project. So users might select a language because they have a policy of writing in a that language but spellchecking might still fail on comments that violate that policy. I see two solutions to that: Either detect the different language and spell check it anyways or detect the violation of the policy. Such a policy could be formally defined and checked by a Linter, but talking Atom Spell Check, I think it should do it's best to spell check as much text as possible. Ignoring mixed languages seems like a one-size-fits-all approach to a problem where this really isn't true.

@jdhoek
Copy link
Author

jdhoek commented Oct 30, 2014

Do you have anything to support that?

Personal experience with mixed Dutch-English documents, and Dutch documents containing a lot of technical jargon in English.

In any case, it is hard — and often impossible if there is not much text to work with — to automatically detect the desired dictionary when languages have multiple variants (as almost all do). When I edit a Dutch manual page, I want the spell-check to use Dutch as written in the Netherlands (and not as written in Belgium, or the Netherlands Antilles), and for the corresponding English page I prefer English, as written in the United Kingdom (explicitly en_GB, rather than en_US). LangID detects only language, not locale.

In my opinion software helpfully selecting not quite the right dictionary is anathema to a good user experience. This is also one of the reasons why web browsers offer the language selection menu, and word-processors such as LibreOffice Writer allow you to set the locale for a specific text-style.

Ignoring mixed languages seems like a one-size-fits-all approach

This issue suggests adding a language selection option, similar to that found in Firefox and Chrome. It fixes the problem of editing text in Atom in one language, whilst your system locale is set to another.

For your suggestion of automatic language detection, you should probably open a new issue or pull request.

@Bengt
Copy link

Bengt commented Nov 14, 2014

In my opinion software helpfully selecting not quite the right dictionary is anathema to a good user experience.

I think it is far better to guess the right dictionary in most cases, than to force selecting it in every case. To stick with your example, language/locale detection might detect en_US while you misspell the british "meagre" as "meager". That should but only happen when there is no text with other words that are written differently among these locales and are correctly spelled in their en_GB variant.

So this should happen far more seldomly than switching back and forward between your native and your secondary language. I think we need to accept some glitches when working on natural language with computers. For example, my Chrome is currently spellchecking en_GB and marks "seldomly" as a misspelling in the sentence previous to the previous sentence.

Ignoring mixed languages seems like a one-size-fits-all approach

This issue [...] fixes the problem of editing text in Atom in one language, whilst your system locale is set to another.

I oppose building a language selection dialogue, now because it might prohibit implementing language detection, in the future. Language detection would also work with texts written in different languages than the system locale and avoid (IMHO at least) the usability fail of forcing the user to switch languages manually.

Perhaps this conflict isn't one though. With a language selection dialogue as suggested here, language detection could preselect a language in said dialogue and the user could override that preselection when language detection fails or just to be sure the right locale is enforced. That way, the language selection dialogue could be implemented now and augmented with a language-detection-based preselection in the future.

@dpagano
Copy link

dpagano commented Jul 15, 2015

I use Atom to take notes in markdown format. I have to do so in different languages.
Changing the system language when switching between two files?? No way.
So currently I have to live with the curly lines and copy the "finished" document over to a different tool to do my checking. I think there are better ways.

@BujiasBitwise
Copy link

Some of my files in English and others in a different language (although I'm trying to keep all of them in English). It would be nice if I could select the language used for the spell check in individual files. Auto detecting them would be better, but I don't know if that solution would be problematic, as previously discussed.
Actually, I would like to see project files that I could store, where this settings were saved. But that would be a different discussion.

@danielschmitz

This comment has been minimized.

@hellboy81

This comment has been minimized.

@louis-etne

This comment has been minimized.

@anaisbetts
Copy link

Detecting languages automatically is quite error prone, especially in a programming context.

This isn't true, node-cld2 will very very accurately detect text as long as it is more than a sentence.

@jdhoek
Copy link
Author

jdhoek commented Oct 24, 2015

@paulcbetts

Unfortunately, an algorithm cannot reliably distinguish between language variants. In fact, cld makes no attempt to so from what I can tell. It only detects the language (e.g., 'English' or en), it does not distinguish between language variants (e.g., en_GB and en_US). This is not good enough for a spell-checker, because spelling dictionaries are language-variant-specific.

Also, such local lingual idiosyncrasies are precisely why we like having spell-checkers in the first place. It is not very helpful if your editor claims "Nice color!" is correct English when you are actually writing text meant for a British audience. 😃

@anaisbetts
Copy link

lol, let's run before we can walk, right now Atom doesn't even do anything other than English

@agsti
Copy link

agsti commented Nov 1, 2015

Hello, I've written few lines that add a rough multi-language support, here is the repo. (wich I don't know if I created correctly, quite new here...)

https://github.com/ihatetothink/spell-check

Right now uses the status bar to choose from the system languages.
It uses a variable inside each active editor which I don't know if it's a good idea.
I'm neither confident of its architecture (even for such a small project!)

I'm still testing by the way... any word will be appreciated.

@Yaco

This comment has been minimized.

@winstliu

This comment has been minimized.

@Yaco

This comment has been minimized.

@FredrikWendt

This comment has been minimized.

@OJFord
Copy link
Contributor

OJFord commented Feb 17, 2016

The above (now merged) PR changes the default spell check language to your system default - i.e. your LANG environment variable.

So while we still can't change the language on the fly, this has been a vast improvement for me, as I only really wanted my system en_GB anyway. If you did want to change to another language, you could set (export LANG=xx_XX) and restart Atom.

@sbrl
Copy link

sbrl commented Feb 17, 2016

@OJFord Thank you! When will that PR be realed as an update to spell-check?

@darobin
Copy link

darobin commented Feb 17, 2016

@OJFord This is already a big improvement, cool. I couldn't find this in the docs: is there a way to run multiple Atom instances in parallel? It's not an ideal solution, but at least it would make it possible to run them with different LANG values.

@OJFord
Copy link
Contributor

OJFord commented Feb 17, 2016

@sbrl No idea I'm afraid; hopefully the dependency will be updated in the next release.. you could modify it yourself to read 3.2.3, and then run npm update. It would need doing again if spell-check was updated without this (or later) change though.

@darobin Yes, just export LANG and run atom alternately from terminal. (If you get 'command not found' or something for atom then I think you need to 'Install Shell Commands' - from the main 'Atom' menu on OS X).

OJFord added a commit to OJFord/spell-check that referenced this issue Feb 17, 2016
As of atom/node-spellchecker#33 (v3.2.3), the default language used is that of the `LANG` environment variable. This is an (non-closing) improvement for those subscribed to atom#21.
@sbrl
Copy link

sbrl commented Feb 17, 2016

@OJFord Ah right. I'm not that desperate (although it sounds like a terribly useful change) - hopefully the next release isn't too far away.

@OJFord
Copy link
Contributor

OJFord commented Feb 17, 2016

I've submitted a PR to specifically address it, otherwise I suppose there may be no reason for anyone to think it was worth updating it for some time.

@OJFord
Copy link
Contributor

OJFord commented Feb 19, 2016

This is now merged and released in v0.67.0 - @sbrl

@sbrl
Copy link

sbrl commented Feb 20, 2016

@OJFord Awesome, thanks!

dmoonfire added a commit to dmoonfire/spell-check that referenced this issue Mar 12, 2016
* Changed the package to allow for external packages to provide additional checking. (Closes atom#74)
  - Diabled the task-based handling because of passing plugins.
  - Two default plugins are included: system-based dictionaries and "known words".
  - Suggestions and "add to dictionary" are also provided via interfaces. (Closes atom#11)
  - Modified various calls so they are aware of the where the buffer is located.
* Modified system to allow for multiple plugins/checkers to identify correctness.
  - Incorrect words must be incorrect for all checkers.
  - Any checker that treats a word as valid is considered valid for the buffer.
* Extracted system-based dictionary support into separate checker.
  - System dictionaries can now check across multiple system locales.
  - Locale selection can be changed via package settings. (Closes atom#21)
  - External search paths can be used for Linux and OS X.
  - Default language is based on Chromium settings.
* Extracted hard-coded approved list into a separate checker.
  - User can add additional "known words" via settings.
  - Added an option to add more known words via the suggestion dialog.
* Updated ignore files and added EditorConfig settings for development.
* Various coffee-centric formatting.
dmoonfire added a commit to dmoonfire/spell-check that referenced this issue Mar 12, 2016
* Changed the package to allow for external packages to provide additional checking. (Closes atom#74)
  - Disabled the task-based handling because of passing plugins.
  - Two default plugins are included: system-based dictionaries and "known words".
  - Suggestions and "add to dictionary" are also provided via interfaces. (Closes atom#11)
  - Modified various calls so they are aware of the where the buffer is located.
* Modified system to allow for multiple plugins/checkers to identify correctness.
  - Incorrect words must be incorrect for all checkers.
  - Any checker that treats a word as valid is considered valid for the buffer.
* Extracted system-based dictionary support into separate checker.
  - System dictionaries can now check across multiple system locales.
  - Locale selection can be changed via package settings. (Closes atom#21)
  - External search paths can be used for Linux and OS X.
  - Default language is based on Chromium settings.
* Extracted hard-coded approved list into a separate checker.
  - User can add additional "known words" via settings.
  - Added an option to add more known words via the suggestion dialog.
* Updated ignore files and added EditorConfig settings for development.
* Various coffee-centric formatting.
dmoonfire added a commit to dmoonfire/spell-check that referenced this issue Mar 12, 2016
* Changed the package to allow for external packages to provide additional checking. (Closes atom#74)
  - Disabled the task-based handling because of passing plugins.
  - Two default plugins are included: system-based dictionaries and "known words".
  - Suggestions and "add to dictionary" are also provided via interfaces. (Closes atom#11)
  - Modified various calls so they are aware of the where the buffer is located.
* Modified system to allow for multiple plugins/checkers to identify correctness.
  - Incorrect words must be incorrect for all checkers.
  - Any checker that treats a word as valid is considered valid for the buffer.
* Extracted system-based dictionary support into separate checker.
  - System dictionaries can now check across multiple system locales.
  - Locale selection can be changed via package settings. (Closes atom#21)
  - External search paths can be used for Linux and OS X.
  - Default language is based on Chromium settings.
* Extracted hard-coded approved list into a separate checker.
  - User can add additional "known words" via settings.
  - Added an option to add more known words via the suggestion dialog.
* Updated ignore files and added EditorConfig settings for development.
* Various coffee-centric formatting.
dmoonfire added a commit to dmoonfire/spell-check that referenced this issue Mar 12, 2016
* Changed the package to allow for external packages to provide additional checking. (Closes atom#74)
  - Disabled the task-based handling because of passing plugins.
  - Two default plugins are included: system-based dictionaries and "known words".
  - Suggestions and "add to dictionary" are also provided via interfaces. (Closes atom#11)
  - Modified various calls so they are aware of the where the buffer is located.
* Modified system to allow for multiple plugins/checkers to identify correctness.
  - Incorrect words must be incorrect for all checkers.
  - Any checker that treats a word as valid is considered valid for the buffer.
* Extracted system-based dictionary support into separate checker.
  - System dictionaries can now check across multiple system locales.
  - Locale selection can be changed via package settings. (Closes atom#21)
  - External search paths can be used for Linux and OS X.
  - Default language is based on Chromium settings.
* Extracted hard-coded approved list into a separate checker.
  - User can add additional "known words" via settings.
  - Added an option to add more known words via the suggestion dialog.
* Updated ignore files and added EditorConfig settings for development.
* Various coffee-centric formatting.
dmoonfire added a commit to dmoonfire/spell-check that referenced this issue Mar 15, 2016
* Changed the package to allow for external packages to provide additional checking. (Closes atom#74)
  - Disabled the task-based handling because of passing plugins.
  - Two default plugins are included: system-based dictionaries and "known words".
  - Suggestions and "add to dictionary" are also provided via interfaces. (Closes atom#10)
  - Modified various calls so they are aware of the where the buffer is located.
* Modified system to allow for multiple plugins/checkers to identify correctness.
  - Incorrect words must be incorrect for all checkers.
  - Any checker that treats a word as valid is considered valid for the buffer.
* Extracted system-based dictionary support into separate checker.
  - System dictionaries can now check across multiple system locales.
  - Locale selection can be changed via package settings. (Closes atom#21)
  - Multiple locales can be selected. (Closes atom#11)
  - External search paths can be used for Linux and OS X.
  - Default language is based on the process environment, with a fallback to the browser, before finally using `en-US` as a fallback.
* Extracted hard-coded approved list into a separate checker.
  - User can add additional "known words" via settings.
  - Added an option to add more known words via the suggestion dialog.
* Updated ignore files and added EditorConfig settings for development.
* Various coffee-centric formatting.
dmoonfire added a commit to dmoonfire/spell-check that referenced this issue Mar 15, 2016
* Changed the package to allow for external packages to provide additional checking. (Closes atom#74)
  - Disabled the task-based handling because of passing plugins.
  - Two default plugins are included: system-based dictionaries and "known words".
  - Suggestions and "add to dictionary" are also provided via interfaces. (Closes atom#10)
  - Modified various calls so they are aware of the where the buffer is located.
* Modified system to allow for multiple plugins/checkers to identify correctness.
  - Incorrect words must be incorrect for all checkers.
  - Any checker that treats a word as valid is considered valid for the buffer.
* Extracted system-based dictionary support into separate checker.
  - System dictionaries can now check across multiple system locales.
  - Locale selection can be changed via package settings. (Closes atom#21)
  - Multiple locales can be selected. (Closes atom#11)
  - External search paths can be used for Linux and OS X.
  - Default language is based on the process environment, with a fallback to the browser, before finally using `en-US` as a fallback.
* Extracted hard-coded approved list into a separate checker.
  - User can add additional "known words" via settings.
  - Added an option to add more known words via the suggestion dialog.
* Updated ignore files and added EditorConfig settings for development.
* Various coffee-centric formatting.
@OJFord
Copy link
Contributor

OJFord commented Mar 20, 2016

FYI @sbrl @darobin this is in Atom 1.7.x, so you can use it now in the beta releases, or hopefully not wait too much longer before stable reaches 1.7.

@sbrl
Copy link

sbrl commented Mar 20, 2016

@OJFord Thanks! I'm using stable. Not too long now!

@MAWSpitau
Copy link

I installed the current beta right now, but I am not able to find any language suggestions...

@ThomasPietrzak
Copy link

I have Atom 1.23.0, and I still can't switch languages manually.
Automatic detection can be useful in some cases. But most of the time, I'm damn better than any algorithm at knowing what language I would like to spell check.

@x0s
Copy link

x0s commented Jan 23, 2019

Here is how I manually switch between system default language (English for me) and others (French for example) on Ubuntu/Atom

  • If you don't already have dictionary in your system:
    • look for it here
    • Install it browsing this URL (example with french): apt://hunspell-fr
  • Add new locale in Locales field under spell-check settings in Atom. The new locale to write is the hunspell suffix (fr in our example)
  • Open a text file(markdown for instance), and the curly lines should be gone except for your typing errors ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests