[TWIG][TEMPLATES] Rename transchoice to trans and make it more generic

This commit is contained in:
Hugo Sales 2022-03-01 13:19:38 +00:00
parent b3374333f3
commit fc203e2e38
No known key found for this signature in database
GPG Key ID: 7D0C7EAFC9D835A0
3 changed files with 5 additions and 5 deletions

View File

@ -9,10 +9,10 @@
{% endfor %}
{% if conversation.show_more %}
<a href="{{ conversation.note.getConversationUrl() }}">
{{ transchoice({
{{ trans({
'1': 'Show an additional reply',
'other': 'Show # additional replies'
}, (conversation.total_replies - config('plugin_tree_notes', 'feed_replies'))) }}
}, {'count': (conversation.total_replies - config('plugin_tree_notes', 'feed_replies'))}) }}
</a>
{% endif %}
</div>

View File

@ -79,7 +79,7 @@ class Extension extends AbstractExtension
new TwigFunction('open_details', [Runtime::class, 'openDetails']),
new TwigFunction('show_stylesheets', [Runtime::class, 'getShowStylesheets']),
new TwigFunction('add_right_panel_block', [Runtime::class, 'addRightPanelBlock']),
new TwigFunction('transchoice', [Runtime::class, 'transchoice']),
new TwigFunction('trans', [Runtime::class, 'trans']),
];
}
}

View File

@ -57,9 +57,9 @@ class Runtime implements RuntimeExtensionInterface, EventSubscriberInterface
$this->request = $req;
}
public function transchoice(array $message, int $count): string
public function trans(array $message, array $arguments): string
{
return _m($message, ['count' => $count]);
return _m($message, $arguments);
}
public function isCurrentRouteActive(string ...$routes): string