From 1535f596f66216ea6b524817cf8f7566dcda6dae Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 19 Apr 2020 06:07:43 +0200 Subject: [PATCH] Add two new support functions. --- app/Support/Steam.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/app/Support/Steam.php b/app/Support/Steam.php index 1eb16f90dc..4c92d5be2c 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -584,4 +584,30 @@ class Steam return $amount; } + /** + * Get user's language. + * + * @return string + */ + public function getLanguage(): string // get preference + { + return app('preferences')->get('language', config('firefly.default_language', 'en_US'))->data; + } + + /** + * Get user's locale. + * + * @return string + */ + public function getLocale(): string // get preference + { + /** @var string $language */ + $locale = app('preferences')->get('locale', config('firefly.default_locale', 'equal'))->data; + if ('equal' === $locale) { + return $this->getLanguage(); + } + + return $locale; + } + }