Remove Config dependency on LocaleManager

This commit is contained in:
Pierre Rudloff 2020-10-21 22:38:09 +02:00
parent 5c75dc2bb0
commit 5b0ee7651b
3 changed files with 32 additions and 32 deletions

View File

@ -124,7 +124,11 @@ class Config
*
* @var string[]
*/
public $genericFormats = [];
public $genericFormats = [
'best/bestvideo' => 'Best',
'bestvideo+bestaudio' => 'Remux best video with best audio',
'worst/worstvideo' => 'Worst',
];
/**
* Enable debug mode.
@ -158,16 +162,6 @@ class Config
$this->applyOptions($options);
$this->getEnv();
$this->validateOptions();
$localeManager = new LocaleManager();
if (empty($this->genericFormats)) {
// We don't put this in the class definition so it can be detected by xgettext.
$this->genericFormats = [
'best/bestvideo' => $localeManager->t('Best'),
'bestvideo+bestaudio' => $localeManager->t('Remux best video with best audio'),
'worst/worstvideo' => $localeManager->t('Worst'),
];
}
foreach ($this->genericFormats as $format => $name) {
if (strpos($format, '+') !== false) {

View File

@ -45,43 +45,55 @@ msgstr ""
msgid "Generic formats"
msgstr ""
#: templates/info.tpl:35
msgid "Best"
msgstr ""
#: templates/info.tpl:36
msgid "Remux best video with best audio"
msgstr ""
#: templates/info.tpl:37
msgid "Worst"
msgstr ""
#: templates/info.tpl:42
msgid "Detailed formats"
msgstr ""
#: templates/info.tpl:80
#: templates/info.tpl:86
msgid "Stream the video through the server"
msgstr ""
#: templates/info.tpl:86
#: templates/info.tpl:92
msgid "Convert into a custom format:"
msgstr ""
#: templates/info.tpl:87
#: templates/info.tpl:93
msgid "Custom format"
msgstr ""
#: templates/info.tpl:87
#: templates/info.tpl:93
msgid "Format to convert to"
msgstr ""
#: templates/info.tpl:92
#: templates/info.tpl:98
msgid "with"
msgstr ""
#: templates/info.tpl:93
#: templates/info.tpl:99
msgid "Bit rate"
msgstr ""
#: templates/info.tpl:94
#: templates/info.tpl:100
msgid "Custom bitrate"
msgstr ""
#: templates/info.tpl:97
#: templates/info.tpl:103
msgid "kbit/s audio"
msgstr ""
#: templates/info.tpl:101 templates/playlist.tpl:38 templates/password.tpl:11
#: templates/info.tpl:107 templates/playlist.tpl:38 templates/password.tpl:11
#: templates/index.tpl:19
msgid "Download"
msgstr ""
@ -142,18 +154,6 @@ msgstr ""
msgid "Bookmarklet"
msgstr ""
#: classes/Config.php:166
msgid "Best"
msgstr ""
#: classes/Config.php:167
msgid "Remux best video with best audio"
msgstr ""
#: classes/Config.php:168
msgid "Worst"
msgstr ""
#: classes/Controller/DownloadController.php:64
#: classes/Controller/FrontController.php:166
msgid "Wrong password"

View File

@ -30,6 +30,12 @@
<select name="format" id="format" class="formats monospace">
<optgroup label="{t}Generic formats{/t}">
{foreach $config->genericFormats as $format => $name}
{*
To make the default generic formats translatable:
{t}Best{/t}
{t}Remux best video with best audio{/t}
{t}Worst{/t}
*}
<option value="{$format}">{t}{$name}{/t}</option>
{/foreach}
</optgroup>