示例#1
0
文件: test.php 项目: TeaMeow/Karen
<?php

function e($shit)
{
    exit(var_dump($shit));
}
include '../src/karen.php';
Karen::initialize('../src/languages/', 'en_us');
_ef(__('not_logged_in'), ['nickname' => 'Yami Odymel']);
示例#2
0
文件: karen.php 项目: TeaMeow/Karen
 /**
  * Detect
  * 
  * Detect the language which the current user is using.
  */
 static function detect()
 {
     $url = self::$urlPrefix;
     $cookie = self::$cookiePrefix;
     if (isset($_GET[$url]) && self::validateISO($_GET[$url])) {
         self::$language = strtolower($_GET[$url]);
     } elseif (isset($_COOKIE[$cookie]) && self::validateISO($_COOKIE[$cookie])) {
         self::$language = strtolower($_COOKIE[$cookie]);
     } else {
         $languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
         $language = strtolower($languages[0]);
         $language = str_replace('-', '_', $language);
         if (self::validateISO($language)) {
             self::$language = $language;
         }
     }
 }