voikko / libreoffice-voikko

Language checker and hyphenator extension for LibreOffice
Mozilla Public License 2.0
13 stars 7 forks source link

LO-voikko 5.0 plugin crashes LO when choosing Plains Cree using syllabics (crk_Cans) #2

Closed snomos closed 8 years ago

snomos commented 8 years ago

To repeat:

  1. Install the attached files in a location readable by LO-voikko (rename from .zip to .zhfst)
  2. Open LibreOffice 5
  3. Create a new document, and type some text in it
  4. Select the text, and open the dialog to specify language
  5. Select Cree, Plains, Syllabic, and click OK

Notice how LO crashes with an error message instead of returning to the text. The error message is as follows:

<class 'NameError'>: global name '_VoikkoHandlePool__containsLocale' is not defined, traceback follows /Users/smo036/Library/Application Support/LibreOffice/4/user/uno_packages/cache/uno_packages/lu25350x6866k.tmp_/voikko-20160127.oxt/pythonpath/VoikkoHandlePool.py:426 in function __containsLocale() [return __containsLocale(loc, locales)] /Users/smo036/Library/Application Support/LibreOffice/4/user/uno_packages/cache/uno_packages/lu25350x6866k.tmp_/voikko-20160127.oxt/pythonpath/VoikkoHandlePool.py:430 in function supportsSpellingLocale() [return self.__containsLocale(locale, self.getSupportedSpellingLocales())] /Users/smo036/Library/Application Support/LibreOffice/4/user/uno_packages/cache/uno_packages/lu25350x6866k.tmp_/voikko-20160127.oxt/pythonpath/SpellChecker.py:40 in function hasLocale() [return VoikkoHandlePool.getInstance().supportsSpellingLocale(aLocale)]

Also notice that the Latn (default) Plains Cree file is not recognised by LO.

crk-Cans.zip crk.zip

hatapitk commented 8 years ago

Thanks for the report! You should be able to fix the crash by replacing VoikkoHandlePool.py from the extension with fixed version from git. This code path seems to have gone untested after conversion to Python. The issue with the default version is still not fixed, I will look into it soon.

hatapitk commented 8 years ago

I wonder why the country code is CN and not CA when that is what this bug report requested? https://bugs.documentfoundation.org/show_bug.cgi?id=73973 http://cgit.freedesktop.org/libreoffice/core/commit/i18nlangtag/source/isolang/isolang.cxx?id=75a22a9fb88b128bb31eb51dc763e42cb76e26c2

hatapitk commented 8 years ago

I think that is the problem here. If you open writing aids settings in LibreOffice you can see that crk is available as supported language. And after you have done this and clicked OK it will also be available as a spell checking language in Writer. So this is the known bug in LibreOffice that the language is not immediately recognized (and that affects also Hunspell). The country code should first be fixed in LibreOffice and then we can see if there is something else that has to be done in the extension

snomos commented 8 years ago

The LibreOffice bug has been reported here:

https://bugs.documentfoundation.org/show_bug.cgi?id=97584