diff --git a/.env b/.env index e3d5643..9dac3a8 100644 --- a/.env +++ b/.env @@ -60,6 +60,7 @@ APP_LOCALE=en APP_LOCALES=en|cs|nl|eo|fr|ja|ka|de|he|it|lv|pl|pt|ru|es|uk # Content categories, lowercase, enabled by default for new users +# src/Twig/AppExtension.php:transCategory APP_CATEGORIES=movie|series|tv|animation|music|game|audiobook|podcast|book|archive|picture|software|other # Items per page on pagination diff --git a/src/Twig/AppExtension.php b/src/Twig/AppExtension.php index c0bbcf4..8da3975 100644 --- a/src/Twig/AppExtension.php +++ b/src/Twig/AppExtension.php @@ -46,6 +46,13 @@ class AppExtension extends AbstractExtension 'urlToMarkdown' ] ), + new TwigFilter( + 'trans_category', + [ + $this, + 'transCategory' + ] + ), ]; } @@ -153,6 +160,29 @@ class AppExtension extends AbstractExtension ); } + public function transCategory( + string $name + ): string + { + switch ($name) + { + case 'movie': return $this->translator->trans('movie'); + case 'series': return $this->translator->trans('series'); + case 'tv': return $this->translator->trans('tv'); + case 'animation': return $this->translator->trans('animation'); + case 'music': return $this->translator->trans('music'); + case 'game': return $this->translator->trans('game'); + case 'audiobook': return $this->translator->trans('audiobook'); + case 'podcast': return $this->translator->trans('podcast'); + case 'book': return $this->translator->trans('book'); + case 'archive': return $this->translator->trans('archive'); + case 'picture': return $this->translator->trans('picture'); + case 'software': return $this->translator->trans('software'); + case 'other': return $this->translator->trans('other'); + default: return $name; + } + } + private function plural(int $number, array $texts) { $cases = [2, 0, 1, 1, 1, 2]; diff --git a/templates/default/torrent/edit/categories.html.twig b/templates/default/torrent/edit/categories.html.twig index c094952..417828d 100644 --- a/templates/default/torrent/edit/categories.html.twig +++ b/templates/default/torrent/edit/categories.html.twig @@ -32,7 +32,7 @@ {% endif %} {% endfor %} diff --git a/templates/default/torrent/info.html.twig b/templates/default/torrent/info.html.twig index 10f8721..4d530ab 100644 --- a/templates/default/torrent/info.html.twig +++ b/templates/default/torrent/info.html.twig @@ -362,7 +362,7 @@ {% if torrent.categories %}
{% set i = 0 %} - {% for category in torrent.categories | sort %}{% if i > 0 %},{% endif %} {{ category | u.title }}{% set i = i + 1 %}{% endfor %} + {% for category in torrent.categories | sort %}{% if i > 0 %},{% endif %} {{ category | trans_category | u.title }}{% set i = i + 1 %}{% endfor %}
{% endif %} diff --git a/templates/default/torrent/submit.html.twig b/templates/default/torrent/submit.html.twig index 4d3283b..c36da9a 100644 --- a/templates/default/torrent/submit.html.twig +++ b/templates/default/torrent/submit.html.twig @@ -72,7 +72,7 @@ {% endif %} {% endfor %} diff --git a/templates/default/user/info.html.twig b/templates/default/user/info.html.twig index dcc72cf..a22da9e 100644 --- a/templates/default/user/info.html.twig +++ b/templates/default/user/info.html.twig @@ -182,7 +182,7 @@ {% set i = 0 %} - {% for category in user.categories | sort %}{% if i > 0 %},{% endif %} {{ category | u.title }}{% set i = i + 1 %}{% endfor %} + {% for category in user.categories | sort %}{% if i > 0 %},{% endif %} {{ category | trans_category | u.title }}{% set i = i + 1 %}{% endfor %} diff --git a/templates/default/user/settings.html.twig b/templates/default/user/settings.html.twig index dc084f3..b7312e6 100644 --- a/templates/default/user/settings.html.twig +++ b/templates/default/user/settings.html.twig @@ -116,7 +116,7 @@ {% endif %} {% endfor %} diff --git a/translations/messages+intl-icu.cs.xlf b/translations/messages+intl-icu.cs.xlf index 1115d0c..b34a837 100644 --- a/translations/messages+intl-icu.cs.xlf +++ b/translations/messages+intl-icu.cs.xlf @@ -849,6 +849,58 @@ have added categories edition have added categories edition + + movie + movie + + + series + series + + + tv + tv + + + animation + animation + + + music + music + + + game + game + + + audiobook + audiobook + + + podcast + podcast + + + book + book + + + archive + archive + + + picture + picture + + + software + software + + + other + other + diff --git a/translations/messages+intl-icu.de.xlf b/translations/messages+intl-icu.de.xlf index cfbeb98..2137691 100644 --- a/translations/messages+intl-icu.de.xlf +++ b/translations/messages+intl-icu.de.xlf @@ -849,6 +849,58 @@ have added categories edition have added categories edition + + movie + movie + + + series + series + + + tv + tv + + + animation + animation + + + music + music + + + game + game + + + audiobook + audiobook + + + podcast + podcast + + + book + book + + + archive + archive + + + picture + picture + + + software + software + + + other + other + diff --git a/translations/messages+intl-icu.en.xlf b/translations/messages+intl-icu.en.xlf index d26ce5e..e4658e8 100644 --- a/translations/messages+intl-icu.en.xlf +++ b/translations/messages+intl-icu.en.xlf @@ -849,6 +849,58 @@ have added categories edition have added categories edition + + movie + movie + + + series + series + + + tv + tv + + + animation + animation + + + music + music + + + game + game + + + audiobook + audiobook + + + podcast + podcast + + + book + book + + + archive + archive + + + picture + picture + + + software + software + + + other + other + diff --git a/translations/messages+intl-icu.eo.xlf b/translations/messages+intl-icu.eo.xlf index a253a32..a9ea8be 100644 --- a/translations/messages+intl-icu.eo.xlf +++ b/translations/messages+intl-icu.eo.xlf @@ -849,6 +849,58 @@ have added categories edition have added categories edition + + movie + movie + + + series + series + + + tv + tv + + + animation + animation + + + music + music + + + game + game + + + audiobook + audiobook + + + podcast + podcast + + + book + book + + + archive + archive + + + picture + picture + + + software + software + + + other + other + diff --git a/translations/messages+intl-icu.es.xlf b/translations/messages+intl-icu.es.xlf index e24ce1d..a5f441d 100644 --- a/translations/messages+intl-icu.es.xlf +++ b/translations/messages+intl-icu.es.xlf @@ -849,6 +849,58 @@ have added categories edition have added categories edition + + movie + movie + + + series + series + + + tv + tv + + + animation + animation + + + music + music + + + game + game + + + audiobook + audiobook + + + podcast + podcast + + + book + book + + + archive + archive + + + picture + picture + + + software + software + + + other + other + diff --git a/translations/messages+intl-icu.fr.xlf b/translations/messages+intl-icu.fr.xlf index 6bc5976..55a2fc0 100644 --- a/translations/messages+intl-icu.fr.xlf +++ b/translations/messages+intl-icu.fr.xlf @@ -849,6 +849,58 @@ have added categories edition have added categories edition + + movie + movie + + + series + series + + + tv + tv + + + animation + animation + + + music + music + + + game + game + + + audiobook + audiobook + + + podcast + podcast + + + book + book + + + archive + archive + + + picture + picture + + + software + software + + + other + other + diff --git a/translations/messages+intl-icu.he.xlf b/translations/messages+intl-icu.he.xlf index 9fa5a88..bb9127f 100644 --- a/translations/messages+intl-icu.he.xlf +++ b/translations/messages+intl-icu.he.xlf @@ -849,6 +849,58 @@ have added categories edition have added categories edition + + movie + movie + + + series + series + + + tv + tv + + + animation + animation + + + music + music + + + game + game + + + audiobook + audiobook + + + podcast + podcast + + + book + book + + + archive + archive + + + picture + picture + + + software + software + + + other + other + diff --git a/translations/messages+intl-icu.it.xlf b/translations/messages+intl-icu.it.xlf index b4cffab..4a27c88 100644 --- a/translations/messages+intl-icu.it.xlf +++ b/translations/messages+intl-icu.it.xlf @@ -849,6 +849,58 @@ have added categories edition have added categories edition + + movie + movie + + + series + series + + + tv + tv + + + animation + animation + + + music + music + + + game + game + + + audiobook + audiobook + + + podcast + podcast + + + book + book + + + archive + archive + + + picture + picture + + + software + software + + + other + other + diff --git a/translations/messages+intl-icu.ja.xlf b/translations/messages+intl-icu.ja.xlf index 45b196f..d94fbba 100644 --- a/translations/messages+intl-icu.ja.xlf +++ b/translations/messages+intl-icu.ja.xlf @@ -849,6 +849,58 @@ have added categories edition have added categories edition + + movie + movie + + + series + series + + + tv + tv + + + animation + animation + + + music + music + + + game + game + + + audiobook + audiobook + + + podcast + podcast + + + book + book + + + archive + archive + + + picture + picture + + + software + software + + + other + other + diff --git a/translations/messages+intl-icu.ka.xlf b/translations/messages+intl-icu.ka.xlf index ffa30a5..dfaece0 100644 --- a/translations/messages+intl-icu.ka.xlf +++ b/translations/messages+intl-icu.ka.xlf @@ -849,6 +849,58 @@ have added categories edition have added categories edition + + movie + movie + + + series + series + + + tv + tv + + + animation + animation + + + music + music + + + game + game + + + audiobook + audiobook + + + podcast + podcast + + + book + book + + + archive + archive + + + picture + picture + + + software + software + + + other + other + diff --git a/translations/messages+intl-icu.lv.xlf b/translations/messages+intl-icu.lv.xlf index 963f4df..b2f07df 100644 --- a/translations/messages+intl-icu.lv.xlf +++ b/translations/messages+intl-icu.lv.xlf @@ -849,6 +849,58 @@ have added categories edition have added categories edition + + movie + movie + + + series + series + + + tv + tv + + + animation + animation + + + music + music + + + game + game + + + audiobook + audiobook + + + podcast + podcast + + + book + book + + + archive + archive + + + picture + picture + + + software + software + + + other + other + diff --git a/translations/messages+intl-icu.nl.xlf b/translations/messages+intl-icu.nl.xlf index b3640ec..85f3f3f 100644 --- a/translations/messages+intl-icu.nl.xlf +++ b/translations/messages+intl-icu.nl.xlf @@ -849,6 +849,58 @@ have added categories edition have added categories edition + + movie + movie + + + series + series + + + tv + tv + + + animation + animation + + + music + music + + + game + game + + + audiobook + audiobook + + + podcast + podcast + + + book + book + + + archive + archive + + + picture + picture + + + software + software + + + other + other + diff --git a/translations/messages+intl-icu.pl.xlf b/translations/messages+intl-icu.pl.xlf index bd71936..80f6e6a 100644 --- a/translations/messages+intl-icu.pl.xlf +++ b/translations/messages+intl-icu.pl.xlf @@ -849,6 +849,58 @@ have added categories edition have added categories edition + + movie + movie + + + series + series + + + tv + tv + + + animation + animation + + + music + music + + + game + game + + + audiobook + audiobook + + + podcast + podcast + + + book + book + + + archive + archive + + + picture + picture + + + software + software + + + other + other + diff --git a/translations/messages+intl-icu.pt.xlf b/translations/messages+intl-icu.pt.xlf index d8f40a7..f046b79 100644 --- a/translations/messages+intl-icu.pt.xlf +++ b/translations/messages+intl-icu.pt.xlf @@ -849,6 +849,58 @@ have added categories edition have added categories edition + + movie + movie + + + series + series + + + tv + tv + + + animation + animation + + + music + music + + + game + game + + + audiobook + audiobook + + + podcast + podcast + + + book + book + + + archive + archive + + + picture + picture + + + software + software + + + other + other + diff --git a/translations/messages+intl-icu.ru.xlf b/translations/messages+intl-icu.ru.xlf index e96055f..81d2f09 100644 --- a/translations/messages+intl-icu.ru.xlf +++ b/translations/messages+intl-icu.ru.xlf @@ -799,55 +799,107 @@ Categories - Categories + Категории At least one category required - At least one category required + Необходимо указать минимум одну категорию Content category - Content category + Категория содержимого This torrent have selected categories - This torrent have selected categories + Этот торрент содержит выбранные категории Edit categories - Edit categories + Редактировать категории Edit categories for torrent - Edit categories for torrent + Редактировать категории для торрента Locale - Locale + Локаль Category - Category + Категория Torrent categories - Torrent categories + Категории торрента have deleted categories edition - have deleted categories edition + удалил редакцию категорий have disapproved categories edition - have disapproved categories edition + отклонил редакцию категорий have approved categories edition - have approved categories edition + утвердил редакцию категорий have added categories edition - have added categories edition + добавил редакцию категорий + + + movie + фильм + + + series + сериал + + + tv + ТВ шоу + + + animation + анимация + + + music + музыка + + + game + игра + + + audiobook + аудиокнига + + + podcast + подкаст + + + book + книга + + + archive + архив + + + picture + изображение + + + software + программа + + + other + другое diff --git a/translations/messages+intl-icu.uk.xlf b/translations/messages+intl-icu.uk.xlf index 7b48cf8..8322f03 100644 --- a/translations/messages+intl-icu.uk.xlf +++ b/translations/messages+intl-icu.uk.xlf @@ -799,55 +799,107 @@ Categories - Categories + Категорії At least one category required - At least one category required + Потрібно вказати щонайменше одну категорію Content category - Content category + Категорія вмісту This torrent have selected categories - This torrent have selected categories + Цей торрент має виділені категорії Edit categories - Edit categories + Змінити категорії Edit categories for torrent - Edit categories for torrent + Редагувати категорії для торенту Locale - Locale + Локаль Category - Category + Категорія Torrent categories - Torrent categories + Категорії торенту have deleted categories edition - have deleted categories edition + видалив редакцію категорій have disapproved categories edition - have disapproved categories edition + відхилив редакцію категорій have approved categories edition - have approved categories edition + затвердив редакцію категорій have added categories edition - have added categories edition + додав редакцію категорій + + + movie + кіно + + + series + серіал + + + tv + ТБ шоу + + + animation + анімація + + + music + музика + + + game + гра + + + audiobook + аудіокнига + + + podcast + подкаст + + + book + книга + + + archive + архів + + + picture + зображення + + + software + програма + + + other + інше