use Cubist\Util\Files\Files;
use Cubist\Util\Files\VirtualDirectory;
use Cubist\Util\Graphics\Color;
+use Cubist\Util\Text;
+use Illuminate\Translation\Translator;
use Psy\Output\Theme;
use RyanChandler\Blade\Blade;
use function PHPUnit\Framework\matches;
$l10n = $this->data->l10n;
$blade = new Blade($this->_resourcesPath() . '/views', $this->_resourcesPath() . '/cache/' . md5(rand(100000, 10000000)) . '/');
- $html = $blade->make('index', ['data' => $this->data, 'quiz' => $this->quiz, 'theme' => $this->theme, '__' => function ($str) use ($l10n) {
- return $l10n[$str] ?? $str;
+ $html = $blade->make('index', ['data' => $this->data, 'quiz' => $this->quiz, 'theme' => $this->theme, '__' => function ($str, $replace = [], $locale = null) use ($l10n) {
+ $str = $l10n[$str] ?? $str;
+ if (!$replace) {
+ return $str;
+ }
+ return Text::l10nReplacements($str, $replace);
}])->render();
$vdir->file_put_contents('index.html', $html);
foreach ($this->theme->getFields() as $f) {
if ($f instanceof \Cubist\Backpack\Magic\Fields\Files) {
$path = $themePageData->getImageFile($f->getName());
- if(!$path){
+ if (!$path) {
continue;
}
$spl = new \SplFileInfo($path);
protected function _font($f)
{
- if(!$f){
- $f='SourceSans';
+ if (!$f) {
+ $f = 'SourceSans';
}
$font = FluidbookFont::getAvailableFonts()[$f];
if ($font['font_kit']) {
protected function _resourcesPath()
{
- if(!$this->quiz->dev_version){
- $this->quiz->dev_version='stable';
+ if (!$this->quiz->dev_version) {
+ $this->quiz->dev_version = 'dev';
}
switch ($this->quiz->dev_version) {
case 'stable':
$this->addField('section_intro', FormSection::class, __('Introduction'));
$this->addField('intro_enable', Checkbox::class, __('Activer l\'écran d\'introduction'), ['default' => 1]);
$this->addField('intro_title', Text::class, __('Titre d\'introduction'), ['when' => ['intro_enable' => ['1']]]);
- $this->addField('intro_text', Textarea::class, __('Titre d\'introduction'), ['when' => ['intro_enable' => ['1']]]);
+ $this->addField('intro_text', Textarea::class, __('Texte d\'introduction'), ['when' => ['intro_enable' => ['1']]]);
$this->addField('intro_button', Text::class, __('Texte du bouton d\'introduction'), ['when' => ['intro_enable' => ['1']]]);
$this->addField('', FormSeparator::class);
$this->addField('intro_custom_mobile', Checkbox::class, __('Personnaliser les textes sur Mobile'), ['when' => ['intro_enable' => ['1']]]);