Bug 58503 - Options->Writing Aids doesn't list the available bundled language modules
Summary: Options->Writing Aids doesn't list the available bundled language modules
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Linguistic (show other bugs)
Version:
(earliest affected)
4.0.0.0.beta2
Hardware: Other All
: medium major
Assignee: Eike Rathke
QA Contact:
URL:
Whiteboard: target:4.1.0 target:4.0.0.2
Keywords: regression
Depends on:
Blocks:
 
Reported: 2012-12-19 08:34 UTC by László Németh
Modified: 2013-01-24 19:39 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Missing grammar checking and spell checking modules in the Options dialog (57.15 KB, image/png)
2012-12-19 08:36 UTC, László Németh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description László Németh 2012-12-19 08:34:57 UTC
Grammar checking (Lightproof (en)) component is missing from the Options->Writing Aids->Available language modules (grammar checking doesn't work either). Also the Hunspell SpellChecker module doesn't listed after removing the system-wide dictionaries on Ubuntu, despite that the spell checking works with the bundled dictionaries (see the attached screenshot).

LinguServiceManager used by the optlingu.cxx (Writing Aids) doesn't know the Grammar checker component and – depending from the available system-wide dictionaries – Hunspell dictionaries of the bundled packages. There is no problem with the extra dictionary extensions.
Comment 1 László Németh 2012-12-19 08:36:11 UTC
Created attachment 71789 [details]
Missing grammar checking and spell checking modules in the Options dialog
Comment 2 László Németh 2012-12-19 09:30:58 UTC
I have made an uninstall/reinstall of the beta1 deb packages (after removing the system spelling dictionaries on Ubuntu). I have found the same problem. Moreover, removing the .config/lodev/4, the newly created registrymodifications.xcu doesn't contain the available language modules, and spell checking doesn't work.

$ diff 4{.old,}/user/registrymodifications.xcu  | grep US
< <item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/SpellCheckerList"><prop oor:name="en-US" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.MySpellSpellChecker</it></value></prop></item>
Comment 3 László Németh 2012-12-19 09:53:09 UTC
Interestingly, installation of the Hungarian dictionary extension fixes the missing English spell checking with the bundled English dictionary extension (but not the English grammar checking).

Eg. related new items in the registrymodifications.xcu after the installation of the Hungarian dictionary extension (I list only the en-US English ones):

<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/LastFoundSpellCheckers"><prop oor:name="en-US" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.MySpellSpellChecker</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/LastFoundThesauri"><prop oor:name="en-US" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.new.Thesaurus</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/SpellCheckerList"><prop oor:name="en-US" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.MySpellSpellChecker</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/GrammarCheckerList"><prop oor:name="hu-HU" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.comp.pyuno.Lightproof.hu_HU</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/HyphenatorList"><prop oor:name="hu-HU" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.LibHnjHyphenator</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/LastFoundGrammarCheckers"><prop oor:name="hu-HU" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.comp.pyuno.Lightproof.hu_HU</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/LastFoundSpellCheckers"><prop oor:name="hu-HU" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.MySpellSpellChecker</it></value></prop></item>
Comment 4 László Németh 2012-12-19 14:48:04 UTC
@Stephan: could you help to fix this problem? It seems, missing Lightproof grammar checking module is not a Python 3.3 porting problem, but a general problem with the bundled dictionary extensions. Thanks, László
Comment 5 Stephan Bergmann 2012-12-19 16:14:00 UTC
I cannot reproduce.  With a recent local Linux libreoffice-4-0 (--enable-release-build) build, with all bundled extensions but dict-en/ removed from install/share/extensions/ and forcing a fresh user profile (i.e., none of ~/.config/libreoffice/, ~/.libreoffice/, ~/.openoffice.org around), starting install/program/soffice "Tools - Options... - Language Settings - Writing Aids - Available language modules" lists "Hunspell SpellChecker", "Lightproof grammar checker (English)", "Libhyphen Hyphenator", and "OpenOffice.org New Thesaurus" (each with a checked checkbox).  And the resulting registrymodifications.xcu contains lots of /org.openoffice.Office.Linguistic/ServiceManager/{GrammarCheckerList,HyphenatorList,LastFoundGrammarCheckers,LastFoundHyphenators,LastFoundSpellCheckers,LastFoundThesauri,SpellCheckerList,ThesaurusList} items.
Comment 6 László Németh 2012-12-19 23:19:39 UTC
Stephan, many thanks for the test! With removed user profiles and /usr/share/hunspell LibreOffice beta 1 wasn't be able to use the bundled dictionaries, but I will check the recent libreoffice-4-0, too and report the result.
Comment 7 László Németh 2012-12-20 08:58:52 UTC
After removing the system dictionaries (/usr/share/hunspell) I have made a new build from the latest libreoffice-4-0, but I have got the same strange problem on Ubuntu 12.04. The extension manager contained (only) the English dictionary extension, but there were no Hunspell and Lightproof modules in the Writing Aids dialog. Installing dict-hu.oxt fixed the missing English spell checking, but not English grammar checking.

I have removed the ~/.openoffice.org, ~/.libreoffice, ~/.config/libreoffice, and the other bundled extensions. My configuration:

make clean
./configure --disable-gnome-vfs --without-doxygen --without-junit --enable-release-build
make
Comment 8 Urmas 2012-12-20 16:53:03 UTC
Daily builds for Windows also don't list any writing aids.
Comment 9 Stephan Bergmann 2012-12-21 08:51:47 UTC
(In reply to comment #8)
> Daily builds for Windows also don't list any writing aids.

Please be more specific.  I installed <http://dev-builds.libreoffice.org/daily/libreoffice-4-0/Win-x86@6/2012-12-21_06.13.16/libreoffice-4-0~2012-12-21_06.13.16_LibO-Dev_4.0.0.0.beta1_Win_x86_install_en-US.msi> into an English Windows 7 without any pre-existing %APPDATA% user profiles for LO/OOo, and "Tools - Options... - Language Settings - Writing Aids - Available language modules" is the same there as what I described in comment 5 for Linux.
Comment 10 Urmas 2012-12-22 05:04:05 UTC
master~2012-12-21_23.39.29_LibO-Dev_4.1.0.0.alpha0_Win_x86_install_en-US.msi, Windows XP 32 bit, running from admin install, fresh profile or not, 0 writing aids available.
Comment 11 László Németh 2012-12-23 02:18:55 UTC
The same problem with beta 2 on Ubuntu 12.04.
Comment 12 Stephan Bergmann 2013-01-07 09:50:19 UTC
(In reply to comment #10)
> master~2012-12-21_23.39.29_LibO-Dev_4.1.0.0.alpha0_Win_x86_install_en-US.msi,
> Windows XP 32 bit, running from admin install, fresh profile or not, 0
> writing aids available.

Do you use an English Windows version?  Otherwise, this might be due to the .msi you are using only containing en-US localization, and none of the contained writing aids data (for English, French, Spanish only) matching your Windows locale, so none being selected automatically during installation.  Have you tried Custom Setup and explicitly enabling any of the Dictionaries available under Optional Components?
Comment 13 Stephan Bergmann 2013-01-07 14:06:50 UTC
László, with any old and new user profile out of the way again, and changing the line 29

  DEBUG = 0

in the LO installation's program/pythonloader.py to

  DEBUG = 1

and then starting soffice from a shell, what does it print on stdout/err?
Comment 14 László Németh 2013-01-07 14:35:07 UTC
(In reply to comment #13)
$ /opt/lodev4.0/program/soffice
pythonloader.Loader ctor
pythonloader.Loader.writeRegistryInfo
pythonloader: interpreting url vnd.sun.star.expand:$BUNDLED_EXTENSIONS/dict-en/Lightproof.py
pythonloader: after expansion file:///opt/lodev4.0/program/../share/extensions/dict-en/Lightproof.py

Stephan, the results are the same with and without the /usr/share/hunspell dictionary,  (but in the first case there is working English spell checking with the system installed dictionaries on Ubuntu).
Comment 15 Stephan Bergmann 2013-01-07 17:05:00 UTC
(In reply to comment #14)
> (In reply to comment #13)
> $ /opt/lodev4.0/program/soffice
> pythonloader.Loader ctor
> pythonloader.Loader.writeRegistryInfo
> pythonloader: interpreting url
> vnd.sun.star.expand:$BUNDLED_EXTENSIONS/dict-en/Lightproof.py
> pythonloader: after expansion
> file:///opt/lodev4.0/program/../share/extensions/dict-en/Lightproof.py

If that is all of the output, then that is very odd.  As protocol is "file", it would need to go into the corresponding if branch in getModuleFromUrl, where mod would need to be null (as this is the first call to getModuleFromUrl, and only this function adds to g_loadedComponents), so it would need to call checkForPythonPathBesideComponent, which would always print something if DEBUG == 1.  Can you add some more print debug statements in your copy of pythonloader.py to help track down the flow of control that happens for you?
Comment 16 Urmas 2013-01-07 22:22:08 UTC
There are three bundled dictionaries installed, available in Extension manager. But still no spellchecker, no thesaurus and no hyphenator modules are available.
Comment 17 Rene Engelhard 2013-01-07 22:39:14 UTC
sberg: when I do this (build of -4-0 from today; python3-uno with system-python 3.3) I get:

$ lowriter 
pythonloader.Loader ctor
pythonloader.Loader.activate
pythonloader: interpreting url file:///usr/lib/libreoffice/program/../share/extensions/lightproof_en/Lightproof.py
pythonloader: after expansion file:///usr/lib/libreoffice/program/../share/extensions/lightproof_en/Lightproof.py
b'checking for existence of /usr/lib/libreoffice/share/extensions/lightproof_en/pythonpath.zip'
b'adding /usr/lib/libreoffice/share/extensions/lightproof_en/pythonpath to sys.path'

when I start Tools-Extension Manager or even Tools->Options.

Interestingly, when I do this with the same build and python-uno with python 2.7 I get:

$ lowriter
pythonloader.Loader ctor
pythonloader.Loader.activate
pythonloader: interpreting url file:///usr/lib/libreoffice/program/../share/extensions/lightproof_en/Lightproof.py
pythonloader: after expansion file:///usr/lib/libreoffice/program/../share/extensions/lightproof_en/Lightproof.py
checking for existence of /usr/lib/libreoffice/share/extensions/lightproof_en/pythonpath.zip
adding /usr/lib/libreoffice/share/extensions/lightproof_en/pythonpath to sys.path
Fetched ImplHelper as <unohelper.ImplementationHelper instance at 0x2ee70e0>

so actually a bit nore, but still not enough to have it work
Comment 18 Stephan Bergmann 2013-01-08 07:48:45 UTC
(In reply to comment #17)
> so actually a bit nore, but still not enough to have it work

OK, this makes it unlikely to be due to something that could be solved by changing the Lightproof.py component in the dict-en extension from active to passive registration.
Comment 19 Stephan Bergmann 2013-01-08 09:37:25 UTC
A different behaviour between LO 3.6 and LO 4.0 that I can reproduce (on Linux) is as follows:

1  A recent local --with-lang='de en-US' libreoffice-3-6 build.
1.1  Remove all subdirs from install/share/extensions/ but dict-en/ (and also keep the package.txt file).
1.2  Remove all existing LO/OOo user profiles (~/.config/libreoffice/ etc.).
1.3  LANG=ru_RU.utf8 LC_ALL=ru_RU.utf8 install/program/soffice  (i.e., using a system locale not covered by LO's --with-lang settings)
1.4  "Tools - Options... - Language Settings - Writing Aids - Available language modules" lists "Hunspell SpellChecker", "Lightproof Grammar Checker (en)", "Libhyphen Hyphenator", and "OpenOffice.org New Thesaurus" (each with a checked checkbox).

2  A recent local --with-lang='de en-US' master build.
1.1  Remove all subdirs from install/share/extensions/ but dict-en/ (and also keep the package.txt file).
1.2  Remove all existing LO/OOo user profiles (~/.config/libreoffice/ etc.).
1.3  LANG=ru_RU.utf8 LC_ALL=ru_RU.utf8 install/program/soffice  (i.e., using a system locale not covered by LO's --with-lang settings)
1.4  "Tools - Options... - Language Settings - Writing Aids - Available language modules" list is empty, "Edit..." button is disabled.
Comment 20 Rene Engelhard 2013-01-08 09:55:38 UTC
FWIW, my build was a --with-lang="en-US de", locale de_DE.UTF-8 (and yes, the lengpack is installed).

Not that that should matter anyways, but.. :)
Comment 21 Stephan Bergmann 2013-01-08 10:32:03 UTC
The difference between libreoffice-3-6 and master is the behaviour of LngSvcMgr::getAvailableServices (linguistic/source/lngsvcmgr.cxx) when called with rServiceName = "com.sun.star.linguistic2.Proofreader" and an empty rLocale (i.e., all Language/Country/Variant members being empty strings).  On both branches, pInfoArray has one element, but master's

LanguageType nLanguage = LanguageTag( rLocale ).getLanguageType();

sets nLanguage to match the system locale (LANGUAGE_RUSSIAN = 0x0419 in the scenario from comment 19), so the following check against LANGUAGE_NONE fails (and the call to getAvailableServices returns an empty sequence), whereas libreoffce-3-6's

LanguageType nLanguage = LocaleToLanguage( rLocale );

sets nLanguage to LANGUAGE_NONE = 0x00FF, so the following check succeeds (and the call to getAvailableServices returns a one-element sequence).

This is due to <http://cgit.freedesktop.org/libreoffice/core/commit/?id=d7a5ec62e91ce3dc5b784815254218f16181f676> "get rid of CreateLocale() and related."  Eike, please take over.
Comment 22 László Németh 2013-01-08 10:46:17 UTC
Many thanks for your investigation!
Comment 23 Not Assigned 2013-01-09 16:01:05 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=241ccc2568dd685d224f8a2b051c3e3a018d9400

resolved fdo#58503 restore awkward handling of empty locale for legacy



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 24 Eike Rathke 2013-01-09 16:06:23 UTC
Pending review for 4-0 as https://gerrit.libreoffice.org/1616
Comment 25 Not Assigned 2013-01-10 11:23:20 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-4-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f4078cb3a2366263227328a53e6cab4631e04bd6&h=libreoffice-4-0

resolved fdo#58503 restore awkward handling of empty locale for legacy


It will be available in LibreOffice 4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.