Improve quiz phrases.

This commit is contained in:
John Preston 2020-01-13 14:01:10 +03:00
parent f700220ec1
commit aac6d0df27
2 changed files with 23 additions and 4 deletions

View File

@ -2173,6 +2173,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_polls_votes_count#one" = "{count} vote";
"lng_polls_votes_count#other" = "{count} votes";
"lng_polls_votes_none" = "No votes";
"lng_polls_answers_count#one" = "{count} answer";
"lng_polls_answers_count#other" = "{count} answers";
"lng_polls_answers_none" = "No answers";
"lng_polls_submit_votes" = "Submit votes";
"lng_polls_view_results" = "View results";
"lng_polls_retract" = "Retract vote";

View File

@ -511,9 +511,17 @@ void Poll::updateTotalVotes() {
return;
}
_totalVotes = _poll->totalVoters;
const auto quiz = _poll->quiz();
const auto string = !_totalVotes
? tr::lng_polls_votes_none(tr::now)
: tr::lng_polls_votes_count(tr::now, lt_count_short, _totalVotes);
? (quiz
? tr::lng_polls_answers_none
: tr::lng_polls_votes_none)(tr::now)
: (quiz
? tr::lng_polls_answers_count
: tr::lng_polls_votes_count)(
tr::now,
lt_count_short,
_totalVotes);
_totalVotesLabel.setText(st::msgDateTextStyle, string);
}
@ -1064,9 +1072,17 @@ TextState Poll::textState(QPoint point, StateRequest request) const {
result.customTooltip = true;
using Flag = Ui::Text::StateRequest::Flag;
if (request.flags & Flag::LookupCustomTooltip) {
const auto quiz = _poll->quiz();
result.customTooltipText = answer.votes
? tr::lng_polls_votes_count(tr::now, lt_count_decimal, answer.votes)
: tr::lng_polls_votes_none(tr::now);
? (quiz
? tr::lng_polls_answers_count
: tr::lng_polls_votes_count)(
tr::now,
lt_count_decimal,
answer.votes)
: (quiz
? tr::lng_polls_answers_none
: tr::lng_polls_votes_none)(tr::now);
}
}
return result;