From 8473e5a5b0ef2e751d87715d767aedf8f3958acc Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 3 Jul 2025 13:51:15 +0200 Subject: [PATCH] wait #7600 @0.25 --- app/Models/ELearningMedia.php | 7 ++++--- resources/views/elearningmedia/index.blade.php | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Models/ELearningMedia.php b/app/Models/ELearningMedia.php index cdcd4c8b8..b34b16127 100644 --- a/app/Models/ELearningMedia.php +++ b/app/Models/ELearningMedia.php @@ -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; } diff --git a/resources/views/elearningmedia/index.blade.php b/resources/views/elearningmedia/index.blade.php index cace5a243..815cd78cd 100644 --- a/resources/views/elearningmedia/index.blade.php +++ b/resources/views/elearningmedia/index.blade.php @@ -12,7 +12,8 @@ @if($type==='pdf') - {{ __('Click here once you have completed your learning session') }} + {{ $translations['Click here once you have completed your learning session']?:'Click here once you have completed your learning session' }} @elseif($type==='audio')