]> _ Git - fluidbook-toolbox.git/commitdiff
wip #7977 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 5 Feb 2026 16:12:23 +0000 (17:12 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 5 Feb 2026 16:12:23 +0000 (17:12 +0100)
app/Fields/FluidbookTTSVoice.php
app/Fluidbook/Compiler/Accessibility.php
app/Http/Controllers/Admin/Operations/Tools/TextToSpeech.php
app/Models/ShortLink.php

index a7dcb286d294067ce98177f40faed7f531d67aee..8e2dc81b935a89e567d8b189cf35404491c09db4 100644 (file)
@@ -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) {
index 7bb0937e8589accbc4c48a80acf5bb0b0e286ce1..991968a985564f440592641269eb49206566d22e 100644 (file)
@@ -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';
index 6e3ff0ce71bca0edceabc391d219f66efc4445d5..c7b5c33f7336d1c8a761e817fc162a7ec1fd5ddb 100644 (file)
@@ -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]);
index dea7ae62522827be6e101547fe8e6265c1974c5b..df234594d2cd76ec67518d1b9bee7fcf13e5a055 100644 (file)
@@ -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
      */