Skip to content
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ ram.runtime = "512M"
type = "group"
default = "visitors"

[install.language]
ask.en = "Choose the application language"
ask.fr = "Choisissez la langue de l'application"
type = "select"
choices = ["en_US", "es_ES", "it_IT", "fr_FR", "de_DE"]
default = "en_US"

[install.user_home]
ask.en = "Access the users home folder from Nextcloud?"
ask.fr = "Accéder au dossier personnel des utilisateurs depuis Nextcloud ?"
Expand Down
11 changes: 11 additions & 0 deletions scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,17 @@ ynh_script_progression --message="Configuring $app..." --weight=8
# Set the mysql.utf8mb4 config to true in config.php
exec_occ config:system:set mysql.utf8mb4 --type boolean --value="true"

# Set default language in config.php
raw_language=$(echo "$language" | awk -F'_' '{print $1}')
exec_occ config:system:set default_language --value="$raw_language"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be just $language here ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, Nextcloud's default_language uses ISO_639-1 language codes such as en for English, see https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#default-language

That's why we need to cut the first part from $language, e.g. take en from en_US.


# Set default locale in config.php
exec_occ config:system:set default_locale --value="$language"

# Set default phone region in config.php
country=$(echo "$language" | awk -F'_' '{print $2}')
exec_occ config:system:set default_phone_region --value="$country"

# Ensure that UpdateNotification app is disabled
exec_occ app:disable updatenotification

Expand Down
12 changes: 12 additions & 0 deletions scripts/upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,18 @@ then
exec_occ maintenance:repair
fi

# Fix warning "Your installation has no default phone region set"
if [ "$(exec_occ config:system:get default_phone_region)" == "" ]; then
config_locale=$(exec_occ config:system:get default_locale)
if [ -z "$config_locale" ]; then
# If it's not set in config use "US" as default
country="US"
else
country=$(echo "$config_locale" | awk -F'_' '{print $2}')
fi
exec_occ config:system:set default_phone_region --value="$country"
fi

# Upgrade may fail if this app is enabled
# Take all apps enabled, and check if mail is one of them
# Then temporary disable the mail app
Expand Down