Skip to content

Commit

Permalink
init locale model #14
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost committed Sep 26, 2023
1 parent b269e24 commit 5e31e0e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/app/model/locale.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

class AppModelLocale {

private $_locales = [];

public function __construct(object $locales)
{
foreach ($locales as $key => $value)
{
$this->_locales[] = (object)
[
'key' => $key,
'value' => $value[0],
'active' => false !== stripos($_SERVER['HTTP_ACCEPT_LANGUAGE'], $key) ? true : false,
];
}
}

public function getLocales() : object
{
return $this->_locales;
}
}

0 comments on commit 5e31e0e

Please sign in to comment.