+
+ /**
+ * Get the ISO version of a BookStack language name
+ */
+ public function getLocaleIso(string $locale): string
+ {
+ return $this->localeMap[$locale] ?? $locale;
+ }
+
+ /**
+ * Set the system date locale for localized date formatting.
+ * Will try both the standard locale name and the UTF8 variant.
+ */
+ protected function setSystemDateLocale(string $locale)
+ {
+ $systemLocale = $this->getLocaleIso($locale);
+ $set = setlocale(LC_TIME, $systemLocale);
+ if ($set === false) {
+ setlocale(LC_TIME, $systemLocale . '.utf8');
+ }
+ }