collabora_ynh icon indicating copy to clipboard operation
collabora_ynh copied to clipboard

Install correct dictionary automatically

Open yamanq opened this issue 1 year ago • 0 comments

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

  • YunoHost version: 11.0.10.2
  • I have access to my server: Through SSH
  • Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: no special case
  • Using, or trying to install package version/branch: 22.05.8.2~ynh2

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"

yamanq avatar Jan 28 '23 21:01 yamanq