From e6942b1c4a32f7b0ad58e203566ad1664ec377fb Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 5 Feb 2026 17:12:23 +0100 Subject: [PATCH] wip #7977 @1.5 --- app/Fields/FluidbookTTSVoice.php | 10 +++++++++- app/Fluidbook/Compiler/Accessibility.php | 2 +- .../Admin/Operations/Tools/TextToSpeech.php | 5 ++--- app/Models/ShortLink.php | 10 ++++++++-- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/app/Fields/FluidbookTTSVoice.php b/app/Fields/FluidbookTTSVoice.php index a7dcb286d..8e2dc81b9 100644 --- a/app/Fields/FluidbookTTSVoice.php +++ b/app/Fields/FluidbookTTSVoice.php @@ -32,9 +32,17 @@ class FluidbookTTSVoice extends SelectFromArray try { $api = new Api(env('AZURE_TTS_API_KEY')); $voices = $api->listVoices(true); + if ($voices) { foreach ($voices as $key => $voice) { - $res['azuretts:' . $voice['Locale'] . '/' . $voice['Gender'] . '/' . $voice['ShortName']] = 'Azure ' . $voice['DisplayName'] . ' (' . $voice['Locale'] . ')'; + if (isset($voice['SecondaryLocaleList'])) { + foreach ($voice['SecondaryLocaleList'] as $secVoice) { + $res['azuretts:' . $voice['Locale'] . '|' . $secVoice . '/' . $voice['Gender'] . '/' . $voice['ShortName']] = 'Azure ' . $voice['DisplayName'] . ' (' . $secVoice . ')'; + } + } else { + $res['azuretts:' . $voice['Locale'] . '/' . $voice['Gender'] . '/' . $voice['ShortName']] = 'Azure ' . $voice['DisplayName'] . ' (' . $voice['Locale'] . ')'; + } + } } } catch (\Exception $e) { diff --git a/app/Fluidbook/Compiler/Accessibility.php b/app/Fluidbook/Compiler/Accessibility.php index 7bb0937e8..991968a98 100644 --- a/app/Fluidbook/Compiler/Accessibility.php +++ b/app/Fluidbook/Compiler/Accessibility.php @@ -85,7 +85,7 @@ trait Accessibility $voiceInfos = $data['voice'] ?? $this->fluidbookSettings->audiodescriptionVoice; if ($voiceInfos) { - $e = explode(':', $voiceInfos); + $e = explode(':', $voiceInfos, 2); if (count($e) === 1) { $engine = 'azuretts'; diff --git a/app/Http/Controllers/Admin/Operations/Tools/TextToSpeech.php b/app/Http/Controllers/Admin/Operations/Tools/TextToSpeech.php index 6e3ff0ce7..c7b5c33f7 100644 --- a/app/Http/Controllers/Admin/Operations/Tools/TextToSpeech.php +++ b/app/Http/Controllers/Admin/Operations/Tools/TextToSpeech.php @@ -7,18 +7,17 @@ use Cubist\Backpack\Magic\Fields\Textarea; use Cubist\Backpack\Magic\Form; use Cubist\Azure\TTS\Api; use Cubist\Util\Files\Files; + // __('!! Outils') trait TextToSpeech { - - public function tts() { $form = new Form(backpack_url('tools/gettts')); $form->setTitle(__('Text to speech')); $form->setSubmitLabel(__('Générer')); $form->setSubmitIcon('la-volume-up'); - $form->addField('voice', SelectFromArray::class, __('Voix'), ['options' => $this->_api()->listVoices(), 'default' => 'fr-FR/Female/fr-FR-DeniseNeural', 'show_selected_option' => true]); + $form->addField('voice', SelectFromArray::class, __('Voix'), ['options' => $this->_api()->listVoices(false, true), 'default' => 'fr-FR/Female/fr-FR-DeniseNeural', 'show_selected_option' => true]); $form->addField('text', Textarea::class, __('Texte')); return view('tools.form', ['form' => $form]); diff --git a/app/Models/ShortLink.php b/app/Models/ShortLink.php index dea7ae625..df234594d 100644 --- a/app/Models/ShortLink.php +++ b/app/Models/ShortLink.php @@ -19,9 +19,10 @@ class ShortLink extends ToolboxModel 'singular' => 'lien', 'plural' => 'liens']; - protected $_enableEdition = false; + protected $_enableEdition = true; protected $_enableClone = false; protected $_enableCreation = false; + protected $_enableDeletion = false; protected $_enableRevisions = false; @@ -37,11 +38,16 @@ class ShortLink extends ToolboxModel $this->addField('server', SelectFromArray::class, __('Serveur'), ['type' => 'hidden', 'options' => LinkShortener::getAvaiableShorteners()]); $this->addField('url', URL::class, __('URL'), ['column' => true]); - $this->addField('shortlink', URL::class, __('Short URL'), ['type' => 'hidden_visible', 'column' => true, 'database_unique' => true]); + $this->addField('shortlink', URL::class, __('Short URL'), ['type' => 'hidden_visible', 'column' => 'url', 'database_unique' => true]); $this->addOwnerField(['column' => false, 'type' => Hidden::class]); } + public function showPrimaryColumn() + { + return false; + } + /** * @throws \Exception */ -- 2.39.5