Skip to content

Commit 97c520b

Browse files
committed
Standalone - implement getUFLocale
1 parent 8c5ba54 commit 97c520b

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

CRM/Utils/System/Standalone.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,21 @@ public function getTimeZoneString() {
576576
return date_default_timezone_get();
577577
}
578578

579+
/**
580+
* @inheritDoc
581+
*/
582+
public function getUFLocale(): ?string {
583+
$userId = $this->getLoggedInUfID();
584+
if ($userId) {
585+
$user = $this->getUserById($userId);
586+
if ($user && !empty($user['language'])) {
587+
return $user['language'];
588+
}
589+
}
590+
591+
return NULL;
592+
}
593+
579594
/**
580595
* @inheritDoc
581596
* @todo implement language negotiation for Standalone?
@@ -696,12 +711,13 @@ protected function registerDefaultPaths(): void {
696711
* Standalone's session cannot be initialized until CiviCRM is booted,
697712
* since it is defined in an extension,
698713
*
699-
* This used to be when we set timezone, but this is moved to
700-
* standaloneusers_civicrm_config hook to avoid crashing multilingual sites`
714+
* This is also when we set timezone
701715
*/
702716
public function postContainerBoot(): void {
703717
$sess = \CRM_Core_Session::singleton();
704718
$sess->initialize();
719+
720+
$this->setTimeZone();
705721
}
706722

707723
}

0 commit comments

Comments
 (0)