From ba1fc23aeaf55801c0e0a554364268e4e87a6049 Mon Sep 17 00:00:00 2001 From: Bob Mottram <bob@freedombone.net> Date: Tue, 27 Nov 2018 11:35:21 +0000 Subject: [PATCH] Ignore any english translations --- src/freedombone-installer | 6 +++++- src/freedombone-utils-webadmin | 20 +++++--------------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/freedombone-installer b/src/freedombone-installer index d9bf52c47..a086a2fb5 100755 --- a/src/freedombone-installer +++ b/src/freedombone-installer @@ -243,8 +243,12 @@ function web_admin_create_app_descriptions { function web_admin_translate_text { text="$1" - local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local DEFAULT_LANGUAGE=$(grep "DEFAULT_LANGUAGE=" "/root/${PROJECT_NAME}.cfg" | awk -F '=' '{print $2}') + if [[ "$DEFAULT_LANGUAGE" == "en_GB"* ]]; then + echo "$text" + return + fi + local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local translations_file="/var/www/${local_hostname}/htdocs/admin/translations/${DEFAULT_LANGUAGE}.txt" if [ -f "$translations_file" ]; then if grep -q "${text}|" "$translations_file"; then diff --git a/src/freedombone-utils-webadmin b/src/freedombone-utils-webadmin index 3c4cc4c59..d67ee870f 100755 --- a/src/freedombone-utils-webadmin +++ b/src/freedombone-utils-webadmin @@ -35,8 +35,6 @@ WEBADMIN_LOGIN_TEXT=$"Welcome to ${PROJECT_NAME}" WEBADMIN_ONION_PORT=5783 -translate_debug= - function web_admin_background_color { if ! grep -q 'WEBADMIN_BACKGROUND_COLOR=' "/root/${PROJECT_NAME}.cfg"; then echo 'WEBADMIN_BACKGROUND_COLOR=white' >> "/root/${PROJECT_NAME}.cfg" @@ -85,16 +83,13 @@ function web_admin_background_color { function web_admin_translate_text { text="$1" - local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local DEFAULT_LANGUAGE=$(grep "DEFAULT_LANGUAGE=" "/root/${PROJECT_NAME}.cfg" | awk -F '=' '{print $2}') - translations_file="/var/www/${local_hostname}/htdocs/admin/translations/${DEFAULT_LANGUAGE}.txt" - - if [ $translate_debug ]; then - echo "*** text $text" - echo "*** local_hostname $local_hostname" - echo "*** DEFAULT_LANGUAGE $DEFAULT_LANGUAGE" - echo "*** translations_file $translations_file" + if [[ "$DEFAULT_LANGUAGE" == "en_GB"* ]]; then + echo "$text" + return fi + local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local + translations_file="/var/www/${local_hostname}/htdocs/admin/translations/${DEFAULT_LANGUAGE}.txt" if [ -f "$translations_file" ]; then if grep -q "${text}|" "$translations_file"; then @@ -493,15 +488,10 @@ function web_admin_create_add_apps { app_title="${SHORT_DESCRIPTION}" if grep -q "${app_name_upper}_DESCRIPTION=" "$app_filename"; then - translate_debug=1 DESCRIPTION="$(grep "${app_name_upper}_DESCRIPTION=" "$app_filename" | head -n 1 | sed 's|\$||g' | sed "s|'||g" | sed 's|\"||g' | awk -F '=' '{print $2}')" - echo "*** DESCRIPTION $DESCRIPTION" translated_description=$(web_admin_translate_text "$DESCRIPTION") - echo "*** translated_description $translated_description" DESCRIPTION="$translated_description" app_title="${DESCRIPTION}" - echo "*** app_title $app_title" - translate_debug= fi if [ $available_apps_ctr -eq 0 ]; then -- GitLab