Crash after selecting language pt-BR
gatolenin opened this issue · comments
Hello
Excuse me the english "google translate". I'm a Twine user and wanted to try Yarn Editor. However, both in the browser and on the desktop version, the program stopped working after trying to change the language settings to pt-BR. In the Browser, it returned to work after clearing the cache of Google Chrome, but in the desktop version, not even uninstalling the program and reinstalling again worked.
Can anyone help me?
Thanks.
I have the same problem. Also, sometimes working in english and resume saving the project, the text entirely disappears.
So whenever you try to get an exotic language, yarn will try to download it from a location since it is not bundling it.
This will lock it up for a second initially,as it is downloading it.
Perhaps I should change this to instead get the languages from a user folder when on electron - but that would mean that you will have to download a BR dictionary file yourself and put it in a specific folder where yarn would expect it
Hello I've run into this issue on my own fork of YarnEditor. It's actually not the downloading that locks up YarnEditor, the hunspell dictionary provided for the language just doesn't actually work. Something goes wrong when trying to parse it and nspell runs an infinite loop for some reason. In fact, a lot of the languages do this. Please see here for more information: wooorm/nspell#11
Unfortunately I was unable to find a fix or a working dictionary for these languages so I had to remove them from the app. Here are the languages that didn't work for me and crashed the app:
- Afrikaans
- Indonesian
- Malay
- Catalan
- Basque
- Galician
- Croatian
- Zulu
- Italian
- Hungarian
- Portuguese
- Finnish
- Chinese
- Japanese
- Latin
Also just for the future, it would be best to refrain from calling other languages "exotic" as it can be seen as offensive. Obviously I know this isn't your intention, but just an FYI for the future.
Another thing we can do is make the fetching of dictionaries an async event. Currently yarn will be blocked and freeze up while it downloads a dictionary, which is not great
The dictionary bit of code is kind of old and I had to alter the library we use in order to make it work better with yarn, thus why its not coming from the node modules folder. We can do anything we like to it, for hard to get dicts we should probably put a copy of them in the public folder for electron only.
We want to keep the web version of yarn as slim as possible in order for it to load fast and not eat alot of mobile broadband
Again, the issue isn't retrieving these dictionaries from the web. The issue is nspell
parsing these dictionaries. It would need a new updated dictionary for nspell
to parse it properly, since nspell
's algorithm is hanging on something inside the dictionary files. Or as an alternative to use a different dictionary parser besides nspell
.
I am going to remove the problematic languages from our language selection for now - as a temporary fix to prevent people from crashing yarn. It would be worth investigating using the browser's native dictionary for spellchecking instead - by browser i also include electron which does have that capability built in.
https://www.electronjs.org/docs/tutorial/spellchecker
The browser knows what the system language is already and has a dictionary for linting spelling mistakes built in.
An ideal solution for me is to scrap the use of an external library altogether here - use the native browser one or electron's depending if the user is on the pwa or electron version of yarn.
The only tricky thing could be in keeping some features we have working the way they do (the stuffin the context menu to suggest correct spelling of words or synonyms)
There is an issue opened for ace-editor here too ajaxorg/ace#2107 to add a native spellchecker
it looks like the server yarn was fetching them from is now changed url. Will need to fix that :(
To be clear these are what yarn uses
https://github.com/wooorm/dictionaries
I have now disabled the dictionaries that are reported to crash Yarn editor, also fixed the path for downloading dictionaries which has changed. We lost access to dicts in those languages - until a better fix is made