Fixes for less than a minute

This commit is contained in:
Htylol 2025-03-05 01:06:10 +05:00
parent bf823316a5
commit c8e835bc95

@ -1264,8 +1264,8 @@ seconds_to_time () {
minutes=$((seconds / 60)) minutes=$((seconds / 60))
seconds=$((seconds % 60)) seconds=$((seconds % 60))
if [[ $days =~ ^0$ ]] ; then if [[ $days == "0" ]] ; then
days= days=""
elif [[ $days =~ ^1$ ]] ; then elif [[ $days =~ ^1$ ]] ; then
days="$days ${translations[day]}, " days="$days ${translations[day]}, "
elif [[ $days =~ ^([2-9]1|[1-9][0-9]+1)$ ]] && [[ $LANGUAGE == ru ]] ; then elif [[ $days =~ ^([2-9]1|[1-9][0-9]+1)$ ]] && [[ $LANGUAGE == ru ]] ; then
@ -1276,8 +1276,8 @@ seconds_to_time () {
days="$days ${translations[days]}, " days="$days ${translations[days]}, "
fi fi
if [[ $hours =~ ^0$ ]] ; then if [[ $hours == "0" ]] ; then
hours= hours=""
elif [[ $hours =~ ^1$ ]] ; then elif [[ $hours =~ ^1$ ]] ; then
hours="$hours ${translations[hour]} ${translations[and]} " hours="$hours ${translations[hour]} ${translations[and]} "
elif [[ $hours =~ ^([2-4]|2[2-4])$ ]] && [[ $LANGUAGE == ru ]] ; then elif [[ $hours =~ ^([2-4]|2[2-4])$ ]] && [[ $LANGUAGE == ru ]] ; then
@ -1288,14 +1288,17 @@ seconds_to_time () {
hours="$hours ${translations[hours]} ${translations[and]} " hours="$hours ${translations[hours]} ${translations[and]} "
fi fi
if [[ $minutes =~ ^0$ ]] ; then if [[ $minutes == "0" ]] ; then
hours=${hours//" ${translations[and]} "/} minutes=""
minutes= if [[ $DESKTOP_WITH_TIME == "posnumber1" && -z $hours ]] \
if [[ -z $days ]] || [[ -z $hours ]] ; then || [[ $DESKTOP_WITH_TIME == "posnumber2" && -z $days && -z $hours ]]; then
days=${days//","/}
fi
if [[ -z $minutes ]] ; then
minutes="${translations[less than a minute]}" minutes="${translations[less than a minute]}"
else
hours=${hours//" ${translations[and]} "/}
if [[ $DESKTOP_WITH_TIME == "posnumber2" ]] \
&& [[ -z $days || -z $hours ]] ; then
days=${days//","/}
fi
fi fi
elif [[ $minutes =~ ^1$ ]] ; then elif [[ $minutes =~ ^1$ ]] ; then
minutes="$minutes ${translations[minute]}" minutes="$minutes ${translations[minute]}"