1
0
mirror of https://github.com/typemill/typemill.git synced 2025-08-04 21:27:41 +02:00

changed way of obtaining labels

This commit is contained in:
severoiuliano@gmail.com
2020-05-24 23:07:30 +02:00
parent b637ea5965
commit 7f8de77e23

View File

@@ -52,31 +52,9 @@ class SetupController extends Controller
$setuperrors = empty($systemcheck) ? false : 'Some system requirements for Typemill are missing.';
$systemcheck = empty($systemcheck) ? false : $systemcheck;
# Get the translated strings
$labels = $this->getSetupLabels();
return $this->render($response, 'auth/setup.twig', array( 'messages' => $setuperrors, 'systemcheck' => $systemcheck, 'labels' => $labels ));
return $this->render($response, 'auth/setup.twig', array( 'messages' => $setuperrors, 'systemcheck' => $systemcheck ));
}
public function getSetupLabels()
{
# Check which languages are available
$langs = [];
$path = __DIR__ . '/../author/languages/*.yaml';
foreach (glob($path) as $filename) {
$langs[] = basename($filename,'.yaml');
}
# Detect browser language
$accept_lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
$lang = in_array($accept_lang, $langs) ? $accept_lang : 'en';
# At least in the setup phase noon there should be no plugins and the theme should be typemill
$labels = \Typemill\Settings::getLanguageLabels($lang,'typemill',[]);
return $labels;
}
public function create($request, $response, $args)
{
@@ -122,9 +100,6 @@ class SetupController extends Controller
/* store updated settings */
\Typemill\Settings::updateSettings(array('welcome' => false));
# Get the translated strings
$labels = $this->getSetupLabels();
return $this->render($response, 'auth/welcome.twig', array( 'labels' => $labels ));
return $this->render($response, 'auth/welcome.twig', array());
}
}