Some internal reorg
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user