Update display time function

This commit is contained in:
Htylol 2024-10-07 07:20:05 +05:00
parent e8492d6f73
commit 0b963639b7
5 changed files with 112 additions and 8 deletions

@ -7,7 +7,7 @@
msgid ""
msgstr "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-07 05:41+0500\n"
"POT-Creation-Date: 2024-10-07 07:15+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -224,6 +224,30 @@ msgstr ""
msgid "Downloading"
msgstr ""
msgid "day"
msgstr ""
msgid "days"
msgstr ""
msgid "hour"
msgstr ""
msgid "and"
msgstr ""
msgid "hours"
msgstr ""
msgid "minute"
msgstr ""
msgid "minutes"
msgstr ""
msgid "Time spent"
msgstr ""
msgid "Do you really want to reinstall PortProton?\\nFor this, an internet "
"connection will be required."
msgstr ""

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-07 05:31+0500\n"
"POT-Creation-Date: 2024-10-07 07:15+0500\n"
"PO-Revision-Date: 2024-09-19 23:35+0500\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -247,6 +247,30 @@ msgstr ""
msgid "Downloading"
msgstr "Descargando"
msgid "day"
msgstr ""
msgid "days"
msgstr ""
msgid "hour"
msgstr ""
msgid "and"
msgstr ""
msgid "hours"
msgstr ""
msgid "minute"
msgstr ""
msgid "minutes"
msgstr ""
msgid "Time spent"
msgstr ""
msgid ""
"Do you really want to reinstall PortProton?\\nFor this, an internet "
"connection will be required."

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-07 05:31+0500\n"
"PO-Revision-Date: 2024-10-07 05:41+0500\n"
"POT-Creation-Date: 2024-10-07 07:15+0500\n"
"PO-Revision-Date: 2024-10-07 07:16+0500\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: ru_RU\n"
@ -248,6 +248,30 @@ msgstr ""
msgid "Downloading"
msgstr "Загружается"
msgid "day"
msgstr "день"
msgid "days"
msgstr "дней"
msgid "hour"
msgstr "час"
msgid "and"
msgstr "и"
msgid "hours"
msgstr "часов"
msgid "minute"
msgstr "минута"
msgid "minutes"
msgstr "минут"
msgid "Time spent"
msgstr "Проведено времени"
msgid ""
"Do you really want to reinstall PortProton?\\nFor this, an internet "
"connection will be required."

@ -820,15 +820,45 @@ seconds_to_time () {
local minutes=$((seconds / 60))
local hours=$((minutes / 60))
local days=$((hours / 24))
local remaining_minutes=$((minutes % 60))
local remaining_hours=$((hours % 24))
if [[ "$LANGUAGE" == ru ]] ; then
echo "\n$days дней, $remaining_hours часов и $remaining_minutes минут"
if [[ $days =~ ^0$ ]] ; then
local remaining_days=
elif [[ $days =~ ^1$ ]] ; then
local remaining_days="$days ${translations[day]}, "
elif [[ $days =~ ^([2-9]1|[1-9][0-9]+1)$ ]] && [[ $LANGUAGE = ru ]] ; then
local remaining_days="$days ${translations[day]}, "
elif [[ $days =~ ^(2|3|4|[2-9]2|[2-9]3|[2-9]4|[1-9][0-9]+2|[1-9][0-9]+3|[1-9][0-9]+4)$ ]] \
&& [[ $LANGUAGE = ru ]] ; then
local remaining_days="$days дня, "
else
echo "\n$days days, $remaining_hours hours and $remaining_minutes minutes"
local remaining_days="$days ${translations[days]}, "
fi
if [[ $remaining_hours =~ ^0$ ]] ; then
local remaining_hours=
elif [[ $remaining_hours =~ ^1$ ]] ; then
local remaining_hours="$hours ${translations[hour]} ${translations[and]} "
elif [[ $remaining_hours =~ ^(2|3|4|22|23|24)$ ]] && [[ $LANGUAGE = ru ]] ; then
local remaining_hours="$hours часа ${translations[and]} "
elif [[ $remaining_hours =~ ^21$ ]] && [[ $LANGUAGE = ru ]] ; then
local remaining_hours="$hours час ${translations[and]} "
else
local remaining_hours="$hours ${translations[hours]} ${translations[and]} "
fi
if [[ $remaining_minutes =~ ^1$ ]] ; then
local remaining_minutes="$remaining_minutes ${translations[minute]}"
elif [[ $remaining_minutes =~ ^[2-5]1$ ]] && [[ $LANGUAGE = ru ]] ; then
local remaining_minutes="$remaining_minutes ${translations[minute]}"
elif [[ $remaining_minutes =~ ^(2|3|4|[2-5]2|[2-5]3|[2-5]4)$ ]] && [[ $LANGUAGE = ru ]] ; then
local remaining_minutes="$remaining_minutes минуты"
else
local remaining_minutes="$remaining_minutes ${translations[minutes]}"
fi
echo "\n${translations[Time spent]}: $remaining_days$remaining_hours$remaining_minutes"
}
combobox_fix () {

@ -506,6 +506,8 @@ if [[ -f "${portwine_exe}" ]] ; then
else
PW_COMMENT_DB="${translations[Launching]} <b>$(print_wrapped "${PORTWINE_DB}" "50")$(seconds_to_time $TIME_CURRENT)</b>"
fi
else
PW_COMMENT_DB="$PW_COMMENT_DB$(seconds_to_time $TIME_CURRENT)"
fi
export KEY_START="$RANDOM"