1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/friendica_ynh.git synced 2024-09-03 18:36:14 +02:00

Merge pull request #57 from YunoHost-Apps/language

Language
This commit is contained in:
Éric Gaspar 2021-07-19 11:46:36 +02:00 committed by GitHub
commit f42174d1e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 6 deletions

View file

@ -2,6 +2,7 @@
; Manifest ; Manifest
domain="domain.tld" domain="domain.tld"
admin="john" admin="john"
language="en"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=0 setup_sub_dir=0

View file

@ -39,6 +39,6 @@ return [
], ],
'system' => [ 'system' => [
'default_timezone' => 'UTC', 'default_timezone' => 'UTC',
'language' => 'en', 'language' => '__LANGUAGE__',
], ],
]; ];

View file

@ -45,6 +45,16 @@
"name": "admin", "name": "admin",
"type": "user", "type": "user",
"example": "johndoe" "example": "johndoe"
},
{
"name": "language",
"type": "string",
"ask": {
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
},
"choices": ["de", "en", "es", "fr", "it", "pt"],
"default": "en"
} }
] ]
} }

View file

@ -28,6 +28,7 @@ domain=$YNH_APP_ARG_DOMAIN
path_url='/' path_url='/'
admin=$YNH_APP_ARG_ADMIN admin=$YNH_APP_ARG_ADMIN
email=$(ynh_user_get_info --username=$admin --key=mail) email=$(ynh_user_get_info --username=$admin --key=mail)
language=$YNH_APP_ARG_LANGUAGE
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -51,6 +52,7 @@ 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=admin --value=$admin ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=email --value=$email ynh_app_setting_set --app=$app --key=email --value=$email
ynh_app_setting_set --app=$app --key=language --value=$language
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
@ -91,7 +93,7 @@ cp -f "$final_path/.htaccess-dist" "$final_path/.htaccess"
git clone --quiet https://github.com/friendica/friendica-addons.git -b stable "$final_path/addon" git clone --quiet https://github.com/friendica/friendica-addons.git -b stable "$final_path/addon"
# Reset addons branch to the level of update we needed # Reset addons branch to the level of update we needed
pushd "$final_path/addon" pushd "$final_path/addon"
git reset --hard $addons_version_commit git reset --hard --quiet $addons_version_commit
popd popd
chmod 750 "$final_path" chmod 750 "$final_path"

View file

@ -25,6 +25,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
email=$(ynh_app_setting_get --app=$app --key=email) email=$(ynh_app_setting_get --app=$app --key=email)
admin=$(ynh_app_setting_get --app=$app --key=admin) admin=$(ynh_app_setting_get --app=$app --key=admin)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
language=$(ynh_app_setting_get --app=$app --key=language)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -82,6 +83,12 @@ if [ -z $email ]; then
ynh_app_setting_set --app=$app --key=email --value=$email ynh_app_setting_set --app=$app --key=email --value=$email
fi fi
# If language setting doesn't exist, create it
if [ -z $language ]; then
language=en
ynh_app_setting_set --app=$app --key=language --value=$language
fi
# Cleaning legacy permissions # Cleaning legacy permissions
if ynh_legacy_permissions_exists; then if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all ynh_legacy_permissions_delete_all
@ -128,25 +135,25 @@ else
cp -a "$final_path/view/smarty3" "$tmpdir/smarty3" cp -a "$final_path/view/smarty3" "$tmpdir/smarty3"
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove "$final_path" ynh_secure_remove --file="$final_path"
# 1 - Clone stable repo # 1 - Clone stable repo
git clone --quiet https://github.com/friendica/friendica.git -b stable "$final_path" git clone --quiet https://github.com/friendica/friendica.git -b stable "$final_path"
# Reset branch to the level of update we needed # Reset branch to the level of update we needed
pushd "$final_path" pushd "$final_path"
git reset --hard $version_commit git reset --hard --quiet $version_commit
popd popd
# 2 - Clone addons repo # 2 - Clone addons repo
git clone --quiet https://github.com/friendica/friendica-addons.git -b stable "$final_path/addon" git clone --quiet https://github.com/friendica/friendica-addons.git -b stable "$final_path/addon"
# Reset addons branch to the level of update we needed # Reset addons branch to the level of update we needed
pushd "$final_path/addon" pushd "$final_path/addon"
git reset --hard $addons_version_commit git reset --hard --quiet $addons_version_commit
popd popd
# Restore the smarty3 folder # Restore the smarty3 folder
cp -a "$tmpdir/smarty3" "$final_path/view/smarty3" cp -a "$tmpdir/smarty3" "$final_path/view/smarty3"
ynh_secure_remove "$tmpdir" ynh_secure_remove --file="$tmpdir"
fi fi
fi fi