From 79ad7a4197298a4bba2a9d0b06305e6ffa2957b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Aleksandrovi=C4=8D=20Klimov?= Date: Wed, 25 Nov 2020 13:34:01 +0100 Subject: [PATCH] Name auto-refresh speeds more human readable Co-authored-by: Johannes Meyer --- application/forms/PreferenceForm.php | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/application/forms/PreferenceForm.php b/application/forms/PreferenceForm.php index d6bbd132d..76e1df680 100644 --- a/application/forms/PreferenceForm.php +++ b/application/forms/PreferenceForm.php @@ -295,20 +295,6 @@ class PreferenceForm extends Form ); if (isset($formData['auto_refresh']) && $formData['auto_refresh']) { - $speeds = [1 => $this->translate('Default')]; - - foreach ([2, 4, 8] as $speed) { - // Using Form#translatePlural() not for $speed==1 and $speed!=1, - // but for different $speed-dependent plural forms, e.g. in Russian - $speeds[$speed] = sprintf($this->translatePlural('%dx slower', '%dx slower', $speed), $speed); - $speeds[rtrim(sprintf('%F', 1.0 / $speed), '0')] = sprintf( - $this->translatePlural('%dx faster', '%dx faster', $speed), - $speed - ); - } - - krsort($speeds); - $this->addElement( 'select', 'auto_refresh_speed', @@ -318,7 +304,12 @@ class PreferenceForm extends Form 'description' => $this->translate( 'This option allows you to speed up or to slow down the global page content auto refresh' ), - 'multiOptions' => $speeds, + 'multiOptions' => [ + '0.5' => $this->translate('Fast', 'refresh_speed'), + '' => $this->translate('Default', 'refresh_speed'), + '2' => $this->translate('Moderate', 'refresh_speed'), + '4' => $this->translate('Slow', 'refresh_speed') + ], 'value' => '' ] );