diff --git a/acp/discord_notifications_module.php b/acp/discord_notifications_module.php index 7a843a7..69422e8 100644 --- a/acp/discord_notifications_module.php +++ b/acp/discord_notifications_module.php @@ -126,33 +126,34 @@ public function main($id, $mode) // Assign template values so that the page reflects the state of the extension settings $this->template->assign_vars([ - 'DN_MASTER_ENABLE' => $this->config['discord_notifications_enabled'], - 'DN_POST_PREVIEW_LENGTH' => $this->config['discord_notifications_post_preview_length'], - 'DN_TEST_MESSAGE_TEXT' => $this->language->lang('DN_TEST_MESSAGE_TEXT'), - 'DN_CONNECT_TIMEOUT' => $this->config['discord_notifications_connect_timeout'], - 'DN_EXEC_TIMEOUT' => $this->config['discord_notifications_exec_timeout'], - - 'DN_POST_CREATE' => $this->config['discord_notification_type_post_create'], - 'DN_POST_UPDATE' => $this->config['discord_notification_type_post_update'], - 'DN_POST_DELETE' => $this->config['discord_notification_type_post_delete'], - 'DN_POST_LOCK' => $this->config['discord_notification_type_post_lock'], - 'DN_POST_UNLOCK' => $this->config['discord_notification_type_post_unlock'], - 'DN_POST_APPROVE' => $this->config['discord_notification_type_post_approve'], - - 'DN_TOPIC_CREATE' => $this->config['discord_notification_type_topic_create'], - 'DN_TOPIC_UPDATE' => $this->config['discord_notification_type_topic_update'], - 'DN_TOPIC_DELETE' => $this->config['discord_notification_type_topic_delete'], - 'DN_TOPIC_LOCK' => $this->config['discord_notification_type_topic_lock'], - 'DN_TOPIC_UNLOCK' => $this->config['discord_notification_type_topic_unlock'], - 'DN_TOPIC_APPROVE' => $this->config['discord_notification_type_topic_approve'], - - 'DN_USER_CREATE' => $this->config['discord_notification_type_user_create'], - 'DN_USER_DELETE' => $this->config['discord_notification_type_user_delete'], - - 'DN_DEFAULT_WEBHOOK' => $this->config['discord_notification_default_webhook'], - - 'DN_CURL_AVAILABLE' => $this->curl_available, - 'U_ACTION' => $this->u_action, + 'DN_MASTER_ENABLE' => $this->config['discord_notifications_enabled'], + 'DN_POST_PREVIEW_LENGTH' => $this->config['discord_notifications_post_preview_length'], + 'DN_POST_PREVIEW_DESCRIPTION' => sprintf($this->language->lang('DN_POST_PREVIEW_DESCRIPTION'), self::MIN_POST_PREVIEW_LENGTH, self::MAX_POST_PREVIEW_LENGTH), + 'DN_TEST_MESSAGE_TEXT' => $this->language->lang('DN_TEST_MESSAGE_TEXT'), + 'DN_CONNECT_TIMEOUT' => $this->config['discord_notifications_connect_timeout'], + 'DN_EXEC_TIMEOUT' => $this->config['discord_notifications_exec_timeout'], + + 'DN_POST_CREATE' => $this->config['discord_notification_type_post_create'], + 'DN_POST_UPDATE' => $this->config['discord_notification_type_post_update'], + 'DN_POST_DELETE' => $this->config['discord_notification_type_post_delete'], + 'DN_POST_LOCK' => $this->config['discord_notification_type_post_lock'], + 'DN_POST_UNLOCK' => $this->config['discord_notification_type_post_unlock'], + 'DN_POST_APPROVE' => $this->config['discord_notification_type_post_approve'], + + 'DN_TOPIC_CREATE' => $this->config['discord_notification_type_topic_create'], + 'DN_TOPIC_UPDATE' => $this->config['discord_notification_type_topic_update'], + 'DN_TOPIC_DELETE' => $this->config['discord_notification_type_topic_delete'], + 'DN_TOPIC_LOCK' => $this->config['discord_notification_type_topic_lock'], + 'DN_TOPIC_UNLOCK' => $this->config['discord_notification_type_topic_unlock'], + 'DN_TOPIC_APPROVE' => $this->config['discord_notification_type_topic_approve'], + + 'DN_USER_CREATE' => $this->config['discord_notification_type_user_create'], + 'DN_USER_DELETE' => $this->config['discord_notification_type_user_delete'], + + 'DN_DEFAULT_WEBHOOK' => $this->config['discord_notification_default_webhook'], + + 'DN_CURL_AVAILABLE' => $this->curl_available, + 'U_ACTION' => $this->u_action, ]); } @@ -247,12 +248,26 @@ private function process_settings_form_submit() // Verify that the post preview length is a numeric string, convert to an int and check the valid range if (!is_numeric($preview_length)) { - trigger_error($this->language->lang('DN_POST_PREVIEW_INVALID') . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error( + sprintf( + $this->language->lang('DN_POST_PREVIEW_INVALID'), + self::MIN_POST_PREVIEW_LENGTH, + self::MAX_POST_PREVIEW_LENGTH + ) . adm_back_link($this->u_action), + E_USER_WARNING + ); } $preview_length = (int) $preview_length; if ($preview_length != 0 && ($preview_length < self::MIN_POST_PREVIEW_LENGTH || $preview_length > self::MAX_POST_PREVIEW_LENGTH)) { - trigger_error($this->language->lang('DN_POST_PREVIEW_INVALID') . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error( + sprintf( + $this->language->lang('DN_POST_PREVIEW_INVALID'), + self::MIN_POST_PREVIEW_LENGTH, + self::MAX_POST_PREVIEW_LENGTH + ) . adm_back_link($this->u_action), + E_USER_WARNING + ); } $connect_timeout = max(1, (int) $this->request->variable('dn_connect_to', 0)); diff --git a/adm/style/acp_discord_notifications_settings.html b/adm/style/acp_discord_notifications_settings.html index 9aa8239..90eed3e 100644 --- a/adm/style/acp_discord_notifications_settings.html +++ b/adm/style/acp_discord_notifications_settings.html @@ -20,7 +20,7 @@

{{ lang('ACP_DISCORD_NOTIFICATIONS') }}

-

{{ lang('DN_POST_PREVIEW_DESCRIPTION') }}
+

{{ DN_POST_PREVIEW_DESCRIPTION }}
diff --git a/language/de/acp_discord_notifications.php b/language/de/acp_discord_notifications.php index 2e8ffd2..6ed72f0 100644 --- a/language/de/acp_discord_notifications.php +++ b/language/de/acp_discord_notifications.php @@ -26,7 +26,7 @@ 'DN_MAIN_SETTINGS' => 'Konfiguration', 'DN_MASTER_ENABLE' => 'Discord Benachrichtigungen aktivieren', 'DN_POST_PREVIEW_LENGTH' => 'Länge der Vorschau', - 'DN_POST_PREVIEW_DESCRIPTION' => 'Wie viele Zeichen eines Beitrags sollen in der Vorschau angezeigt werden? (10-2000, 0 deaktiviert die Vorschau)', + 'DN_POST_PREVIEW_DESCRIPTION' => 'Wie viele Zeichen eines Beitrags sollen in der Vorschau angezeigt werden? (%1$d-%2$d), 0 deaktiviert die Vorschau)', 'DN_TEST_MESSAGE' => 'Nachricht', 'DN_TEST_MESSAGE_TEXT' => 'Dies ist ein Test: Hallo, Discord!', 'DN_TEST_DESCRIPTION' => 'Nachricht, die beim Starten eines Tests geschickt wird.', @@ -80,5 +80,5 @@ // Success/Failure messages that can be generated once the user saves 'DN_SETTINGS_SAVED' => 'Einstellungen aktualisiert.', 'DN_WEBHOOK_URL_INVALID' => 'Die Webhook-URL ist ungültig. Bitte überprüfe die Konfiguration.', - 'DN_POST_PREVIEW_INVALID' => 'Länge der Vorschau muss zwischen 10 und 2000 Zeichen sein (oder 0 zum Deaktivieren der Vorschau).', + 'DN_POST_PREVIEW_INVALID' => 'Länge der Vorschau muss zwischen %1$d und %2$d Zeichen sein (oder 0 zum Deaktivieren der Vorschau).', )); diff --git a/language/en/acp_discord_notifications.php b/language/en/acp_discord_notifications.php index 83d36b5..5adf96d 100644 --- a/language/en/acp_discord_notifications.php +++ b/language/en/acp_discord_notifications.php @@ -26,7 +26,7 @@ 'DN_MAIN_SETTINGS' => 'Main Settings', 'DN_MASTER_ENABLE' => 'Enable Discord Notifications', 'DN_POST_PREVIEW_LENGTH' => 'Post Preview Length', - 'DN_POST_PREVIEW_DESCRIPTION' => 'Specify the number of characters to display in a post preview (10 - 2000). A zero value disables post preview.', + 'DN_POST_PREVIEW_DESCRIPTION' => 'Specify the number of characters to display in a post preview (%1$d-%2$d). A zero value disables post preview.', 'DN_TEST_MESSAGE' => 'Message', 'DN_TEST_MESSAGE_TEXT' => 'This is a test: Hello Discord!', 'DN_TEST_DESCRIPTION' => 'A message to send to Discord to verify that the connection with phpBB is functioning.', @@ -80,5 +80,5 @@ // Success/Failure messages that can be generated once the user saves 'DN_SETTINGS_SAVED' => 'Discord Notification settings modified successfully.', 'DN_WEBHOOK_URL_INVALID' => 'Discord webhook URL must be a full and valid URL.', - 'DN_POST_PREVIEW_INVALID' => 'Post preview length must be a number between 10 and 2000, or 0 to disable previews.', + 'DN_POST_PREVIEW_INVALID' => 'Post preview length must be a number between %1$d and %2$d, or 0 to disable previews.', )); diff --git a/language/fr/acp_discord_notifications.php b/language/fr/acp_discord_notifications.php index bc27da6..61348d6 100644 --- a/language/fr/acp_discord_notifications.php +++ b/language/fr/acp_discord_notifications.php @@ -47,7 +47,7 @@ 'DN_MAIN_SETTINGS' => 'Paramètres généraux', 'DN_MASTER_ENABLE' => 'Activer les notifications Discord', 'DN_POST_PREVIEW_LENGTH' => 'Longueur de l’aperçu des messages', - 'DN_POST_PREVIEW_DESCRIPTION' => 'Permet de saisir le nombre de caractères à afficher dans l’aperçu des messages (10 - 2000). Définir sur la valeur 0 pour désactiver l’aperçu des messages.', + 'DN_POST_PREVIEW_DESCRIPTION' => 'Permet de saisir le nombre de caractères à afficher dans l’aperçu des messages (%1$d-%2$d). Définir sur la valeur 0 pour désactiver l’aperçu des messages.', 'DN_TEST_MESSAGE' => 'Message', 'DN_TEST_MESSAGE_TEXT' => 'Texte du message de test : Hello Discord!', 'DN_TEST_DESCRIPTION' => 'Permet d’envoyer un message sur le serveur Discord afin de vérifier que la connexion avec phpBB est fonctionnelle.', @@ -101,5 +101,5 @@ // Success/Failure messages that can be generated once the user saves 'DN_SETTINGS_SAVED' => 'Les paramètres de notification Discord ont été modifiés avec succès !', 'DN_WEBHOOK_URL_INVALID' => 'L’adresse URL Webhook du serveur Discord doit être complète et correspondre à une adresse URL valide.', - 'DN_POST_PREVIEW_INVALID' => 'La longueur de l’aperçu des messages doit être comprise entre 10 et 2000 ou définie sur 0 pour la désactivation de l’aperçu.', + 'DN_POST_PREVIEW_INVALID' => 'La longueur de l’aperçu des messages doit être comprise entre %1$d et %2$d ou définie sur 0 pour la désactivation de l’aperçu.', ));