From f39d3d8ea403c52bbb49b309d68418da41a450be Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 26 Sep 2023 22:39:55 +0300 Subject: [PATCH] update AppModelLocale --- src/app/model/locale.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/model/locale.php b/src/app/model/locale.php index 2334adb..91272b1 100644 --- a/src/app/model/locale.php +++ b/src/app/model/locale.php @@ -6,27 +6,27 @@ class AppModelLocale { public function __construct(object $locales) { - foreach ($locales as $key => $value) + foreach ($locales as $code => $value) { $this->_locales[] = (object) [ - 'key' => $key, + 'code' => $code, 'value' => $value[0], - 'active' => false !== stripos($_SERVER['HTTP_ACCEPT_LANGUAGE'], $key) ? true : false, + 'active' => false, ]; } } - public function getLocales() : object + public function getList() : object { return (object) $this->_locales; } - public function localeKeyExists(string $key) : bool + public function codeExists(string $code) : bool { foreach ($this->_locales as $locale) { - if ($locale->key === $key) + if ($locale->code === $code) { return true; }