diff --git a/src/Extension/FluentExtension.php b/src/Extension/FluentExtension.php index b829c0ef..6980ee57 100644 --- a/src/Extension/FluentExtension.php +++ b/src/Extension/FluentExtension.php @@ -3,6 +3,7 @@ namespace TractorCow\Fluent\Extension; use LogicException; +use SilverStripe\i18n\i18n; use SilverStripe\Core\ClassInfo; use SilverStripe\Core\Config\Config; use SilverStripe\Core\Convert; @@ -1055,12 +1056,13 @@ public function LocaleInformation($locale = null) $localeObj = Locale::getDefault(); } - if (!$locale && !$localeObj) { - // There is no default locale, this can happen when if fluent is installed though locales have been setup - // This will happen when doing integration unit testing, though can also happen during - // regular website operation - // This temporary Locale is created to prevent a invalid argument exception in RecordLocale::__construct() - $localeObj = Locale::create(['Title' => 'Temp locale']); + if (!$localeObj) { + // There is no default locale, this can happen if no locales have been setup + // This will happen when doing integration unit testing, though can also happen during regular + // website operation + // This temporary Locale is created to prevent a invalid argument exception in + // RecordLocale::__construct() + $localeObj = Locale::create(['Locale' => i18n::get_locale()]); } return RecordLocale::create($this->owner, $localeObj);