mirror of
https://github.com/YunoHost-Apps/seafile_ynh.git
synced 2024-09-03 20:26:01 +02:00
Fix language management
This commit is contained in:
parent
f7c3546bc8
commit
b0580c33e6
2 changed files with 10 additions and 21 deletions
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue