mirror of
https://github.com/friendica/friendica
synced 2024-11-18 07:03:40 +00:00
Merge pull request #11531 from annando/display-polls
Improved poll texts for different conditions
This commit is contained in:
commit
b18880221a
2 changed files with 38 additions and 8 deletions
|
@ -3201,13 +3201,28 @@ class Item
|
||||||
$percent = $question['voters'] ? ($option['replies'] / $question['voters'] * 100) : 0;
|
$percent = $question['voters'] ? ($option['replies'] / $question['voters'] * 100) : 0;
|
||||||
|
|
||||||
$options[$key]['percent'] = $percent;
|
$options[$key]['percent'] = $percent;
|
||||||
|
|
||||||
|
if ($question['voters'] > 0) {
|
||||||
$options[$key]['vote'] = DI::l10n()->t('%s (%d%s, %d votes)', $option['name'], round($percent, 1), '%', $option['replies']);
|
$options[$key]['vote'] = DI::l10n()->t('%s (%d%s, %d votes)', $option['name'], round($percent, 1), '%', $option['replies']);
|
||||||
|
} else {
|
||||||
|
$options[$key]['vote'] = DI::l10n()->t('%s (%d votes)', $option['name'], $option['replies']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($question['voters']) && !empty($question['endtime'])) {
|
||||||
|
$summary = DI::l10n()->t('%d voters. Poll end: %s', $question['voters'], Temporal::getRelativeDate($question['endtime']));
|
||||||
|
} elseif (!empty($question['voters'])) {
|
||||||
|
$summary = DI::l10n()->t('%d voters.', $question['voters']);
|
||||||
|
} elseif (!empty($question['endtime'])) {
|
||||||
|
$summary = DI::l10n()->t('Poll end: %s', Temporal::getRelativeDate($question['endtime']));
|
||||||
|
} else {
|
||||||
|
$summary = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$content .= Renderer::replaceMacros(Renderer::getMarkupTemplate('content/question.tpl'), [
|
$content .= Renderer::replaceMacros(Renderer::getMarkupTemplate('content/question.tpl'), [
|
||||||
'$question' => $question,
|
'$question' => $question,
|
||||||
'$options' => $options,
|
'$options' => $options,
|
||||||
'$summary' => DI::l10n()->t('%d voters. Poll end: %s', $question['voters'], Temporal::getRelativeDate($question['endtime'])),
|
'$summary' => $summary,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
DI::profiler()->stopRecording();
|
DI::profiler()->stopRecording();
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: 2022.05-rc\n"
|
"Project-Id-Version: 2022.05-rc\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2022-05-16 05:29+0000\n"
|
"POT-Creation-Date: 2022-05-16 06:01+0000\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@ -2534,8 +2534,8 @@ msgid ""
|
||||||
"<a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">%2$s</a> %3$s"
|
"<a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">%2$s</a> %3$s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Content/Text/BBCode.php:1188 src/Model/Item.php:3243
|
#: src/Content/Text/BBCode.php:1188 src/Model/Item.php:3258
|
||||||
#: src/Model/Item.php:3249 src/Model/Item.php:3250
|
#: src/Model/Item.php:3264 src/Model/Item.php:3265
|
||||||
msgid "Link to source"
|
msgid "Link to source"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -3738,17 +3738,32 @@ msgstr ""
|
||||||
msgid "bytes"
|
msgid "bytes"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Model/Item.php:3199
|
#: src/Model/Item.php:3201
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid "%s (%d%s, %d votes)"
|
msgid "%s (%d%s, %d votes)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Model/Item.php:3205
|
#: src/Model/Item.php:3203
|
||||||
|
#, php-format
|
||||||
|
msgid "%s (%d votes)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/Model/Item.php:3208
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid "%d voters. Poll end: %s"
|
msgid "%d voters. Poll end: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/Model/Item.php:3231 src/Model/Item.php:3232
|
#: src/Model/Item.php:3210
|
||||||
|
#, php-format
|
||||||
|
msgid "%d voters."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/Model/Item.php:3212
|
||||||
|
#, php-format
|
||||||
|
msgid "Poll end: %s"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/Model/Item.php:3246 src/Model/Item.php:3247
|
||||||
msgid "View on separate page"
|
msgid "View on separate page"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue