/** @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);
}
/**
* @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());
$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;
}