collabora_ynh
collabora_ynh copied to clipboard
Install correct dictionary automatically
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
- Install app on locale that is not en-uk, de-de or fr.
- 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"