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

Can't use Romance languages #57

Closed
writemonkey opened this issue Feb 14, 2017 · 2 comments
Closed

Can't use Romance languages #57

writemonkey opened this issue Feb 14, 2017 · 2 comments

Comments

@writemonkey
Copy link

Hello, I managed to integrate typo.js into my nw.js + Codemirror project just fine, but can't use it with Romance languages (Italian, Spanish, French ...). When trying to load them, there is a lengthy pause an then my app crashes.

Is there a way to make those dictionaries to work?

Thanks for the great library,

i.

@whyteks
Copy link

whyteks commented Mar 15, 2020

I see this issue is old, but maybe as good a place to comment as any.

In an attempt to get https://github.com/hackmdio/codimd to show Spanish spelling errors,
I could not get https://github.com/wooorm/dictionaries/tree/master/dictionaries/es to work at all.

I do not know anything at all about parsing the Hunspell SFX lines, but one thing seems sure;

parseRuleCodes() is broken here as with the first SFX line, we fail badly:
https://github.com/wooorm/dictionaries/blob/master/dictionaries/es/index.aff#L112

    SFX A r ción/S ar

Please take a look at https://github.com/cfinke/Typo.js/blob/master/typo/typo.js#L534
I think this is wrong: we have "FLAG" in this.flags and so we do not in fact match any if stanza here and therefore the function returns undefined, resulting in an exception when we try to access .length of undefined in

https://github.com/cfinke/Typo.js/blob/master/typo/typo.js#L327

Are you supposed to reset this.flags at some point?

I tried returning something by default, adding

return textCodes.split("");

at Line 549 and now the dictionary works.

@cfinke I hope that may be of some use to you.

Best regards.

@cfinke
Copy link
Owner

cfinke commented Aug 1, 2022

Thanks for the heads up; I've fixed this in 14f9749 by adding support for UTF-8 flags.

Running textCodes.split("") would indeed work for this specific dictionary, but if it actually used any UTF-8 flags, it would have led to some unexpected behavior.

@cfinke cfinke closed this as completed Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants