diff --git a/manifest.json b/manifest.json index 5c52be5..468eb5f 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "" }, "requirements": { - "yunohost": ">= 4.0.0" + "yunohost": ">= 4.1.7" }, "multi_instance": true, "services": [ @@ -25,34 +25,32 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain for TiddlyWiki", - "fr": "Choisissez un nom de domaine pour TiddlyWiki" - }, "example": "domain.org" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for TiddlyWiki", - "fr": "Choisissez un chemin pour TiddlyWiki" - }, "example": "/tiddlywiki", "default": "/tiddlywiki" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "help": { "en": "If enabled, TiddlyWiki will be accessible by people who doesn’t have an account. This can be changed later via the webadmin.", "fr": "Si cette case est cochée, TiddlyWiki sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." }, "default": true + }, + { + "name": "language", + "type": "string", + "ask": { + "en": "Choose the application language", + "fr": "Choisissez la langue de l'application" + }, + "choices": ["fr", "en"], + "default": "fr" } ] } diff --git a/scripts/change_url b/scripts/change_url index e912667..6e8d89a 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -8,8 +8,6 @@ source /usr/share/yunohost/helpers -ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS #================================================= diff --git a/scripts/install b/scripts/install index de02526..6d31eb5 100755 --- a/scripts/install +++ b/scripts/install @@ -22,6 +22,7 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC +language=$YNH_APP_ARG_LANGUAGE app=$YNH_APP_INSTANCE_NAME @@ -42,8 +43,9 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= 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=path --value=$path_url +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=language --value=$language #================================================= # 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" 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 diff --git a/scripts/upgrade b/scripts/upgrade index 90cac05..b3fcb6e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,6 +18,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +language=$(ynh_app_setting_get --app=$app --key=language) #================================================= # CHECK VERSION @@ -36,6 +37,19 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path 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 + +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -61,7 +75,12 @@ then # Download, check integrity, uncompress and patch the source from app.src #ynh_setup_source --dest_dir="$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 + fi fi #=================================================