cfinke/Typo.js

en_GB dictionaries not working

Closed this issue · 1 comments

I'm having problems with typo.js when using the en_GB dictionaries downloaded from here:
https://cgit.freedesktop.org/libreoffice/dictionaries/tree/en

It would seem that check() is returning TRUE for every word I pass, even random characters like 'wefwef'.

Looking at the code it would appear that the compound rule check (lines 675-684 in typo.js) passes due to two blank compoundRules existing after the en_GB definition files have been parsed.

if (typeof ruleCodes === 'undefined') {
	// Check if this might be a compound word.
	if ("COMPOUNDMIN" in this.flags && word.length >= this.flags.COMPOUNDMIN) {
		for (i = 0, _len = this.compoundRules.length; i < _len; i++) {
			if (word.match(this.compoundRules[i])) {
				return true;
			}
		}
	}
}

Is this an easy fix?

Thank you for a great product by the way!

Thank you very much 👍