2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Use proper localization in new notification mute time selector

This commit is contained in:
RadRussianRus
2021-08-25 21:30:11 +03:00
parent 4699df03e6
commit ec8d9c7523
3 changed files with 68 additions and 16 deletions

View File

@@ -228,5 +228,37 @@
"ktg_reminder_preview": "Remind with preview",
"ktg_schedule_preview": "Send preview scheduled",
"ktg_language_reloaded": "Kotatogram-specific language strings were reloaded.",
"ktg_notifications_mute_seconds": {
"zero": "seconds",
"one": "second",
"two": "seconds",
"few": "seconds",
"many": "seconds",
"other": "seconds"
},
"ktg_notifications_mute_minutes": {
"zero": "minutes",
"one": "minute",
"two": "minutes",
"few": "minutes",
"many": "minutes",
"other": "minutes"
},
"ktg_notifications_mute_hours": {
"zero": "hours",
"one": "hour",
"two": "hours",
"few": "hours",
"many": "hours",
"other": "hours"
},
"ktg_notifications_mute_days": {
"zero": "days",
"one": "day",
"two": "days",
"few": "days",
"many": "days",
"other": "days"
},
"dummy_last_string": ""
}

View File

@@ -228,5 +228,37 @@
"ktg_reminder_preview": "Напомнить с помощью превью",
"ktg_schedule_preview": "Отправить превью позже",
"ktg_language_reloaded": "Языковые строки Kotatogram были перезагружены.",
"ktg_notifications_mute_seconds": {
"zero": "секунд",
"one": "секунда",
"two": "секунды",
"few": "секунды",
"many": "секунд",
"other": "секунды"
},
"ktg_notifications_mute_minutes": {
"zero": "минут",
"one": "минута",
"two": "минуты",
"few": "минуты",
"many": "минут",
"other": "минуты"
},
"ktg_notifications_mute_hours": {
"zero": "часов",
"one": "час",
"two": "часа",
"few": "часа",
"many": "часов",
"other": "часа"
},
"ktg_notifications_mute_days": {
"zero": "дней",
"one": "день",
"two": "дня",
"few": "дня",
"many": "дней",
"other": "дня"
},
"dummy_last_string": ""
}

View File

@@ -65,25 +65,13 @@ void MuteSettingsBox::prepare() {
const auto group = std::make_shared<Ui::RadiobuttonGroup>(kForeverHours);
y += st::boxOptionListPadding.top();
const auto trimLangStr = [] (const QString &numberStr, const QString &langStr) {
return langStr.mid(numberStr.length()).trimmed();
};
const auto makePeriodText = [=, this] (Period period) {
const auto currentValue = _forNumberInput->getLastText().toInt();
const auto currentStrValue = QString::number(currentValue); // re-converting to get rid of the invalid symbols
switch (period) {
case Period::Second:
return trimLangStr(currentStrValue, tr::lng_group_call_duration_seconds(tr::now, lt_count, currentValue));
case Period::Minute:
return trimLangStr(currentStrValue, tr::lng_group_call_duration_minutes(tr::now, lt_count, currentValue));
case Period::Hour:
return trimLangStr(currentStrValue, tr::lng_group_call_duration_hours(tr::now, lt_count, currentValue));
case Period::Day:
return trimLangStr(currentStrValue, tr::lng_group_call_duration_days(tr::now, lt_count, currentValue));
case Period::Second: return ktr("ktg_notifications_mute_seconds", currentValue);
case Period::Minute: return ktr("ktg_notifications_mute_minutes", currentValue);
case Period::Hour: return ktr("ktg_notifications_mute_hours", currentValue);
case Period::Day: return ktr("ktg_notifications_mute_days", currentValue);
default:
return QString();