Some internal reorg

This commit is contained in:
Deon George
2014-09-29 22:06:38 +10:00
parent 9ae0980221
commit 037633f084
25 changed files with 710 additions and 59 deletions

View File

@@ -33,7 +33,7 @@ abstract class lnApp_Site {
}
/**
* Return the site configured language
* Return the site configured id
*/
public static function ID($format=FALSE) {
return $format ? sprintf('%02s',Kohana::$config->load('config')->id) : Kohana::$config->load('config')->id;
@@ -43,6 +43,19 @@ abstract class lnApp_Site {
* Return the site configured language
*/
public static function Language() {
foreach (Request::factory()->accept_lang() as $k=>$v) {
if (strlen($k) == 2)
$k = sprintf('%s_%s',strtolower($k),strtoupper($k));
else {
list($k,$v) = preg_split('/[-_]/',$k,2);
$k = sprintf('%s_%s',strtolower($k),strtoupper($v));
}
if ($x=ORM::factory('Language',array('iso'=>$k)))
return $x;
}
// @todo Return Default Language
return Kohana::$config->load('config')->language;
}