Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple dictionaries per file #1069

Open
forthrin opened this issue Jan 20, 2016 · 13 comments

Comments

8 participants
@forthrin
Copy link

commented Jan 20, 2016

I use Sublime Text to write fiction in which the same text file may contain several languages, especially in lines spoken by characters of different nationalities, for example Norwegian, English and Japanese.

When using spell checking, it seems I must settle on a single language, which means text in other languages will be marked as "incorrectly spelled" and marked in red. Annoying and confusing.

What would be the best way to overcome this? Can support be added for multiple dictionaries per file, for example?

If it makes a difference, I do most of this writing in the Fountainhead package, if that makes it easier to come up with a solution (such as handling spoken lines in a particular way.)

@titoBouzout

This comment has been minimized.

Copy link
Member

commented Jan 21, 2016

The issue with this is that there is no API to spell-check, but basically everything else (selecting lines, highlighting, changing words) is possible.

@FichteFoll FichteFoll changed the title Multiple dictionaries per text file Multiple dictionaries per file Jan 21, 2016

@oliva

This comment has been minimized.

Copy link

commented Aug 10, 2016

The same happens for me when programming or writing translation files where the variables are in English and the strings are in a different language.

@evandrocoan

This comment has been minimized.

Copy link

commented Oct 10, 2016

As I write both in English and Portuguese, I combined the English Dictionary with the Portuguese dictionary. So, now I got spell checking on both languages. You may find this dictionary here:

  1. https://github.com/evandrocoan/SublimeTextStudio/tree/develop/MultiLingual%20Dictionary
@Dxhs

This comment has been minimized.

Copy link

commented Nov 2, 2016

@evandrocoan I just did this with my Norwegian and English. 322044 lines + 470122. Took me 5 minutes to c+p it with kate on linux. Lol

@titoBouzout

This comment has been minimized.

Copy link
Member

commented Nov 2, 2016

Can you please briefly but precisely describe how do you that? Im interested Thanks!

@evandrocoan

This comment has been minimized.

Copy link

commented Nov 2, 2016

Steps to merge 2 dictionaries files

  1. Download new dictionaries from: https://github.com/titoBouzout/Dictionaries
  2. Duplicate the file EN_US.txt as EN_US_MY_LANG.txt
  3. Duplicate the file EN_US.aff as EN_US_MY_LANG.aff
  4. Duplicate the file EN_US.dic as EN_US_MY_LANG.dic
  5. Open your MY_LANG.txt and append its contents on EN_US_MY_LANG.txt.
  6. Open your MY_LANG.aff and merge its contents on EN_US_MY_LANG.aff using your intelligence.
  7. Open your MY_LANG.dic and append its contents on EN_US_MY_LANG.dic and update the EN_US_MY_LANG.dic first file line with the correct number of words on this new file.
  8. Set EN_US_MY_LANG as your default spelling check language.

Now you got spelling on 2 languages. But there are some downsides:

  1. When merging the files .aff you need to take care on how you do it otherwise it may crash Sublime Text.
  2. The misspelling suggestions will not be accurate most times, as you now got distinct languages bond by the same misspelling/spelling prediction rules.
@Dxhs

This comment has been minimized.

Copy link

commented Nov 2, 2016

@titoBouzout In linux, I used the cat command with shell redirection (>) into my output file:
english.dic norwegian.dic > output.dic.
If use my standard text editor, it crashes. Lshell did it in milliseconds. I suggest using Lshell or Cmd.

@titoBouzout

This comment has been minimized.

Copy link
Member

commented Nov 3, 2016

Thanks for the explanation! Ill try :)

@gustavobittencourt

This comment has been minimized.

Copy link

commented Nov 10, 2016

Thank you, @evandrocoan!

I'll try to install your EN_PT dictionary here!

@Kristinita

This comment has been minimized.

Copy link

commented Nov 15, 2016

I can not to merge Russian and English dictionaries, I get bad results. See part of answer of hunspell contributor:

Bilingual spellchecker is not supported, at least not in reliable way. Merging dictionaries should be out of question.

Thanks.

@evandrocoan

This comment has been minimized.

Copy link

commented Nov 15, 2016

@dimztimz is correct on this:

Instead, at API level you can instantiate multiple objects of the spellchecker with different languages. Then you can check the word in each object. This is the most reliable way for now.

Therefore as it is to be performed by the Sublime Text spell checking core. So we need to wait for them to implement this feature for the best functionality.

Now I got good results with some disadvantages merging the EN _ PT dictionaries. However these two languages are pretty similar. For English and Russian, should not be easy to merge them, if it is possible.

@Kristinita

This comment has been minimized.

Copy link

commented Feb 7, 2017

More programs use Hunspell as Sublime Text. Can try to find extension for another program. I try use in Sublime Text Firefox Russian-English Bilingual addon, and it successfully worked for me.

Kristina

But for single language spellchecking package LanguageTool — the best solution with many nice features.

Thanks.

@megadr01d

This comment has been minimized.

Copy link

commented Jul 12, 2017

And I thought I had it with

{
    "dictionary":
    [
        "Packages/Language - English/en_US.dic",
        "Packages/Language - Other/Portuguese (European).dic"
    ]
}

Alas, no.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.