Browse Source

update AppModelLocale

main
ghost 1 year ago
parent
commit
f39d3d8ea4
  1. 12
      src/app/model/locale.php

12
src/app/model/locale.php

@ -6,27 +6,27 @@ class AppModelLocale { @@ -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;
}

Loading…
Cancel
Save