Fix language management

This commit is contained in:
Josué Tille 2024-04-26 23:35:01 +02:00
parent f7c3546bc8
commit b0580c33e6
No known key found for this signature in database
GPG key ID: 5F259226AD51F2F5
2 changed files with 10 additions and 21 deletions

View file

@ -310,11 +310,7 @@ TIME_ZONE = "{{ time_zone }}"
LANGUAGE_CODE = '{{ language }}' LANGUAGE_CODE = '{{ language }}'
# Custom language code choice. # Custom language code choice.
LANGUAGES = ( # LANGUAGES = ( )
{%- for lang in lang_list.splitlines() -%}
('{{ lang.split(',')[0]}}', '{{ lang.split(',')[1] }}'),
{%- endfor %}
)
# Set this to your website/company's name. This is contained in email notifications and welcome message when user login for the first time. # 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' SITE_NAME = 'Seafile'

View file

@ -2,29 +2,22 @@
# SET ALL CONSTANTS # SET ALL CONSTANTS
#================================================= #=================================================
time_zone=$(cat /etc/timezone) readonly time_zone="$(cat /etc/timezone)"
language=$(echo $LANG | cut -d_ -f1) readonly python_version="$(python3 -V | cut -d' ' -f2 | cut -d. -f1-2)"
python_version="$(python3 -V | cut -d' ' -f2 | cut -d. -f1-2)"
# Create special path with / at the end # Create special path with / at the end
if [[ $path == '/' ]] if [[ $path == '/' ]]
then then
path2="$path" readonly path2="$path"
else else
path2="$path/" readonly path2="$path/"
fi fi
lang_map() { if [ "${LANG:0:2}" == C. ]; then
while read -r item; do readonly language=en
if [ "$item" == en ]; then else
lang_name=english readonly language="${LANG:0:2}"
else fi
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)
#================================================= #=================================================
# DEFINE ALL COMMON FONCTIONS # DEFINE ALL COMMON FONCTIONS