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 }}'
|
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'
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue