diff options
author | Joas Schilling <coding@schilljs.com> | 2020-07-08 15:22:11 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-07-08 15:30:49 +0300 |
commit | 91648c874e0e556ee343e6860afffcfa82df23a4 (patch) | |
tree | 832814a8ac3adbca91f9433b7687c01b77acfc25 /lib/Push.php | |
parent | 21955ac0dbb7ab383878ac8ca6b45e42d783fded (diff) |
Use the L10N factory to get the users language
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Push.php')
-rw-r--r-- | lib/Push.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Push.php b/lib/Push.php index 8e7c00e..717cf24 100644 --- a/lib/Push.php +++ b/lib/Push.php @@ -36,6 +36,7 @@ use OCP\IDBConnection; use OCP\ILogger; use OCP\IUser; use OCP\IUserManager; +use OCP\L10N\IFactory; use OCP\Notification\IManager as INotificationManager; use OCP\Notification\INotification; use Symfony\Component\Console\Output\OutputInterface; @@ -57,6 +58,8 @@ class Push { protected $clientService; /** @var ICache */ protected $cache; + /** @var IFactory */ + protected $l10nFactory; /** @var ILogger */ protected $log; /** @var OutputInterface */ @@ -70,6 +73,7 @@ class Push { IUserManager $userManager, IClientService $clientService, ICacheFactory $cacheFactory, + IFactory $l10nFactory, ILogger $log) { $this->db = $connection; $this->notificationManager = $notificationManager; @@ -79,6 +83,7 @@ class Push { $this->userManager = $userManager; $this->clientService = $clientService; $this->cache = $cacheFactory->createDistributed('pushtokens'); + $this->l10nFactory = $l10nFactory; $this->log = $log; } @@ -107,10 +112,7 @@ class Push { $this->printInfo('Trying to push to ' . count($devices) . ' devices'); $this->printInfo(''); - $language = $this->config->getSystemValue('force_language', false); - $language = \is_string($language) ? $language : $this->config->getUserValue($notification->getUser(), 'core', 'lang', null); - $language = $language ?? $this->config->getSystemValue('default_language', 'en'); - + $language = $this->l10nFactory->getUserLanguage($user); $this->printInfo('Language is set to ' . $language); try { |