1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/tiddlywiki_ynh.git synced 2024-09-03 20:26:34 +02:00

Add language

This commit is contained in:
ericgaspar 2021-03-10 18:08:54 +01:00
parent f324bdb7be
commit febdc6fdf9
No known key found for this signature in database
GPG key ID: 574F281483054D44
3 changed files with 32 additions and 3 deletions

View file

@ -53,6 +53,16 @@
"fr": "Si cette case est cochée, TiddlyWiki sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." "fr": "Si cette case est cochée, TiddlyWiki sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
}, },
"default": true "default": true
},
{
"name": "language",
"type": "string",
"ask": {
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
},
"choices": ["fr", "en"],
"default": "fr"
} }
] ]
} }

View file

@ -22,6 +22,7 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -44,6 +45,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=language --value=$language
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -58,7 +60,12 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
#ynh_setup_source --dest_dir="$final_path" #ynh_setup_source --dest_dir="$final_path"
mkdir -p $final_path mkdir -p $final_path
cp -a ../sources/empty.html $final_path/empty.html
if [ "$language" = "fr" ]; then
cp -a ../sources/empty_fr.html $final_path/empty.html
else
cp -a ../sources/empty.html $final_path/empty.html
fi
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION

View file

@ -18,6 +18,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -36,6 +37,12 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi fi
# Save the language used if not present
if [ -z "$language" ]; then
language="en"
ynh_app_setting_set --app=$app --key=language --value=$language
fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -61,7 +68,12 @@ then
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
#ynh_setup_source --dest_dir="$final_path" #ynh_setup_source --dest_dir="$final_path"
mkdir -p $final_path mkdir -p $final_path
if [ "$language" = "fr" ]; then
cp -a ../sources/empty_fr.html $final_path/empty.html
else
cp -a ../sources/empty.html $final_path/empty.html cp -a ../sources/empty.html $final_path/empty.html
fi
fi fi
#================================================= #=================================================