YunoHost-Apps / collabora_ynh

Collabora package for YunoHost
https://www.collaboraoffice.com/
GNU General Public License v3.0
16 stars 13 forks source link

Install correct dictionary automatically #70

Open yamanq opened 1 year ago

yamanq commented 1 year ago

Describe the bug

When installing the app, dictionaries are automatically installed as solved by #69. However, these are the wrong dictionaries for my installation's locale. I was personally able to fix the issue by installing the right dictionary, but this should be done automatically.

Context

Steps to reproduce

  1. Install app on locale that is not en-uk, de-de or fr.
  2. Open Collabora and note that spelling correction is not enabled/correct.

Expected behavior

The correct hunspell dictionaries should be installed

Potential solution

Since locale gives the current locale of the user, we can use that to determine the write hunspell package. However, we also need to install apt-file so that we can find the right hunspell package.

apt install apt-file
apt-file update
dictionary=$(apt-file search --package-only "/usr/share/hunspell/$(echo $LANG | cut -d '.' -f 1).dic")
apt install $dictionary

I am not sure exactly how to port this to yunohost conventions (ynh_package_install?) but I think this is a good start to get spelling correction working on all locales:

ynh_package_install apt-file
apt-file update
dictionary=$(apt-file search --package-only "/usr/share/hunspell/$(echo $LANG | cut -d '.' -f 1).dic")
ynh_install_app_dependencies "$dictionary"