mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Optimize queries.
This commit is contained in:
@@ -590,6 +590,11 @@ class Steam
|
|||||||
*/
|
*/
|
||||||
public function getLocale(): string // get preference
|
public function getLocale(): string // get preference
|
||||||
{
|
{
|
||||||
|
$singleton = PreferencesSingleton::getInstance();
|
||||||
|
$cached = $singleton->getPreference('locale');
|
||||||
|
if(null !== $cached) {
|
||||||
|
return $cached;
|
||||||
|
}
|
||||||
$locale = app('preferences')->get('locale', config('firefly.default_locale', 'equal'))->data;
|
$locale = app('preferences')->get('locale', config('firefly.default_locale', 'equal'))->data;
|
||||||
if (is_array($locale)) {
|
if (is_array($locale)) {
|
||||||
$locale = 'equal';
|
$locale = 'equal';
|
||||||
@@ -601,9 +606,9 @@ class Steam
|
|||||||
|
|
||||||
// Check for Windows to replace the locale correctly.
|
// Check for Windows to replace the locale correctly.
|
||||||
if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
|
if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
|
||||||
return str_replace('_', '-', $locale);
|
$locale = str_replace('_', '-', $locale);
|
||||||
}
|
}
|
||||||
|
$singleton->setPreference('locale', $locale);
|
||||||
return $locale;
|
return $locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user