2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Unified general phrases for duration.

This commit is contained in:
23rd
2022-03-31 19:45:11 +03:00
committed by John Preston
parent fb750b69e3
commit d9541b6a6e
17 changed files with 61 additions and 153 deletions

View File

@@ -79,14 +79,14 @@ ChooseTimeResult ChooseTimeWidget(
const auto hour = Ui::MakeWeak(state->hour);
const auto minute = Ui::MakeWeak(state->minute);
day->setPhrase(tr::lng_mute_box_days);
day->setPhrase(tr::lng_days);
day->setMaxValue(31);
day->setWheelStep(1);
day->putNext() | rpl::start_with_next([=](QChar ch) {
putNext(hour, ch);
}, content->lifetime());
hour->setPhrase(tr::lng_mute_box_hours);
hour->setPhrase(tr::lng_hours);
hour->setMaxValue(23);
hour->setWheelStep(1);
hour->putNext() | rpl::start_with_next([=](QChar ch) {
@@ -96,7 +96,7 @@ ChooseTimeResult ChooseTimeWidget(
erasePrevious(day);
}, content->lifetime());
minute->setPhrase(tr::lng_mute_box_minutes);
minute->setPhrase(tr::lng_minutes);
minute->setMaxValue(59);
minute->setWheelStep(10);
minute->erasePrevious() | rpl::start_with_next([=] {

View File

@@ -30,20 +30,11 @@ constexpr auto kMaxLabelLength = 32;
if (date > 0) {
return langDateTime(base::unixtime::parse(date));
} else if (-date < kDay) {
return tr::lng_group_call_duration_hours(
tr::now,
lt_count,
(-date / kHour));
return tr::lng_hours(tr::now, lt_count, (-date / kHour));
} else if (-date < 7 * kDay) {
return tr::lng_group_call_duration_days(
tr::now,
lt_count,
(-date / kDay));
return tr::lng_days(tr::now, lt_count, (-date / kDay));
} else {
return tr::lng_local_storage_limit_weeks(
tr::now,
lt_count,
(-date / (7 * kDay)));
return tr::lng_weeks(tr::now, lt_count, (-date / (7 * kDay)));
}
}