From b0580c33e601bb8ae41c6893a12427a2176336d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Fri, 26 Apr 2024 23:35:01 +0200 Subject: [PATCH] Fix language management --- conf/seahub_settings.py | 6 +----- scripts/_common.sh | 25 +++++++++---------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/conf/seahub_settings.py b/conf/seahub_settings.py index 2606ee7..4c72450 100644 --- a/conf/seahub_settings.py +++ b/conf/seahub_settings.py @@ -310,11 +310,7 @@ TIME_ZONE = "{{ time_zone }}" LANGUAGE_CODE = '{{ language }}' # Custom language code choice. -LANGUAGES = ( -{%- for lang in lang_list.splitlines() -%} - ('{{ lang.split(',')[0]}}', '{{ lang.split(',')[1] }}'), -{%- endfor %} -) +# LANGUAGES = ( ) # Set this to your website/company's name. This is contained in email notifications and welcome message when user login for the first time. SITE_NAME = 'Seafile' diff --git a/scripts/_common.sh b/scripts/_common.sh index cbe0e13..3e8cc87 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -2,29 +2,22 @@ # SET ALL CONSTANTS #================================================= -time_zone=$(cat /etc/timezone) -language=$(echo $LANG | cut -d_ -f1) -python_version="$(python3 -V | cut -d' ' -f2 | cut -d. -f1-2)" +readonly time_zone="$(cat /etc/timezone)" +readonly python_version="$(python3 -V | cut -d' ' -f2 | cut -d. -f1-2)" # Create special path with / at the end if [[ $path == '/' ]] then - path2="$path" + readonly path2="$path" else - path2="$path/" + readonly path2="$path/" fi -lang_map() { - while read -r item; do - if [ "$item" == en ]; then - lang_name=english - else - lang_name="$((grep -E "^[a-z]+[[:space:]]+${item}_" /usr/share/locale/locale.alias || echo "$item") | head -n1 | cut -f1)" - fi - echo "$item,$lang_name" - done -} -lang_list=$(grep -E '^[a-z]' /etc/locale.gen | cut -d_ -f1 | uniq | lang_map) +if [ "${LANG:0:2}" == C. ]; then + readonly language=en +else + readonly language="${LANG:0:2}" +fi #================================================= # DEFINE ALL COMMON FONCTIONS