]> _ Git - fluidbook-toolbox.git/commitdiff
wait #7600 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 3 Jul 2025 11:51:15 +0000 (13:51 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 3 Jul 2025 11:51:15 +0000 (13:51 +0200)
app/Models/ELearningMedia.php
resources/views/elearningmedia/index.blade.php

index cdcd4c8b8ed2b9c64e7e024df3a7058ed531c777..b34b1612783d88603d70b177b0686142f699fed6 100644 (file)
@@ -116,7 +116,7 @@ class ELearningMedia extends ToolboxModel
 
         /** @var Media $file */
         $file = $this->getMediaInField('file')->first()->getPath();
-        self::compileFromFile($file, $dest, $this->title, $organization, 'MEDIA_' . $this->id, $this->scorm_version, $this->type === 'pdf' && $this->complete_button ? "'button'" : $this->complete_pct);
+        self::compileFromFile($file, $dest, $this->title, $organization, 'MEDIA_' . $this->id, $this->locale, $this->scorm_version, $this->type === 'pdf' && $this->complete_button ? "'button'" : $this->complete_pct);
     }
 
     /**
@@ -129,7 +129,7 @@ class ELearningMedia extends ToolboxModel
      * @return string
      * @throws \Exception
      */
-    public static function compileFromFile($file, $dest, $title, $organization, $reference, $scorm_version = Version::SCORM_2004, $complete_pct = 75)
+    public static function compileFromFile($file, $dest, $title, $organization, $reference, $locale = 'en', $scorm_version = Version::SCORM_2004, $complete_pct = 75)
     {
         $spl = new \SplFileInfo($file);
         $ext = mb_strtolower($spl->getExtension());
@@ -158,7 +158,8 @@ class ELearningMedia extends ToolboxModel
             $vdir->file_put_contents('pdfjs/web/viewer.css', $css);
         }
         $vdir->copy($file, 'media.' . $ext);
-        $vdir->file_put_contents('index.html', view('elearningmedia.index', ['complete_pct' => $complete_pct, 'title' => $title, 'type' => $type]));
+        $translations = ElearningTranslate::getLocaleTranslations($locale, true);
+        $vdir->file_put_contents('index.html', view('elearningmedia.index', ['complete_pct' => $complete_pct, 'title' => $title, 'type' => $type, 'translations' => $translations]));
         $vdir->sync(true);
         return $title;
     }
index cace5a243a54ecfc4c786900277544acf57211f9..815cd78cdc3afd2bb574e8f8798ffd327e58c3fa 100644 (file)
@@ -12,7 +12,8 @@
 <body>
 @if($type==='pdf')
     <iframe id="player" frameborder="0" src="pdfjs/web/viewer.html?file=../../media.pdf#page=1"></iframe>
-    <a href="#" id="completeButton">{{ __('Click here once you have completed your learning session') }}</a>
+    <a href="#"
+       id="completeButton">{{ $translations['Click here once you have completed your learning session']?:'Click here once you have completed your learning session' }}</a>
 @elseif($type==='audio')
     <button type="button" id="audiobigplay" class="plyr__control plyr__control--overlaid" data-plyr="play"
             aria-label="Play">