From 878d46be25f2c740b8ca5061eaf81614aafdfafd Mon Sep 17 00:00:00 2001 From: Bob Mottram <bob@freedombone.net> Date: Mon, 30 Jul 2018 10:56:17 +0100 Subject: [PATCH] Get the language subdirectory for web admin --- src/freedombone-utils-webadmin | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/freedombone-utils-webadmin b/src/freedombone-utils-webadmin index 84f22a376..24dee8c94 100755 --- a/src/freedombone-utils-webadmin +++ b/src/freedombone-utils-webadmin @@ -415,11 +415,25 @@ function web_admin_create_installed_apps { chown -R www-data:www-data "/var/www/${local_hostname}/htdocs/admin" } +function web_admin_get_language_subdir { + # Gets the subdirectory for the current language + # This is an upper case version of the first two characters of + # the config variable DEFAULT_LANGUAGE + + read_config_param DEFAULT_LANGUAGE + if [ ! "$DEFAULT_LANGUAGE" ]; then + echo 'EN' + return + fi + lang_lower="${DEFAULT_LANGUAGE:0:2}" + echo "$lang_lower" | awk '{print toupper($0)}' +} + function install_web_admin { # This is intended as an admin web user interface # similar to Plinth or the yunohost - language_subdir='EN' + language_subdir=$(web_admin_get_language_subdir) local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local -- GitLab