<commit_before><?php
function __($token)
{
    $isArray = is_array(Karen::getString($token));
    
    return $isArray ? Karen::getString($token)[0] : Karen::getString($token);
}

function _e($token)
{
    echo __($token);
}

function _n($token, $number)
{
    $isArray = is_array(Karen::getString($token));
    
    if(!$isArray)
        return Karen::getString($token);
    
    if($number == 0 || $number == 1)
        return Karen::getString($token)[0];
    else
        return Karen::getString($token)[1];
}

function _en($token, $number)
{
    echo _n($token, $number);
}

class Karen
{
    static $language     = false;
    static $urlPrefix    = 'lang';
    static $cookiePrefix = 'karen_language';
    static $languagePath = '';
    static $library      = [];
    
    static function initialize($languagePath)
    {
        self::$languagePath = $languagePath;
        
        self::detect();
        self::loadLanguage();
    }
    
    static function getString($token)
    {
        return isset(self::$library[$token]) ? self::$library[$token] : null;
    }
    
    
    static function validateISO($value)
    {
        return preg_match('/^[a-zA-Z]{2}(_[a-zA-Z]{2})?$/', $value);
    }
    
    
    static function loadLanguage()
    {
        $path = self::$languagePath . self::$language . '.php';

        if(file_exists($path))
        {
            require($path);
            
            self::$library = $library;
        }
    }
    
    static function detect()
    {
        $url    = self::$urlPrefix;
        $cookie = self::$cookiePrefix;

        if(isset($_GET[$url]) && self::validateISO($_GET[$url]))
        {<commit_msg>textDomain() is now supported.<commit_after><?php
function __($token)
{
    $isArray = is_array(Karen::getString($token));
    
    return $isArray ? Karen::getString($token)[0] : Karen::getString($token);
}

function _e($token)
{
    echo __($token);
}

function _n($token, $number)
{
    $isArray = is_array(Karen::getString($token));
    
    if(!$isArray)
        return Karen::getString($token);
    
    if($number == 0 || $number == 1)
        return Karen::getString($token)[0];
    else
        return Karen::getString($token)[1];
}

function _en($token, $number)
{
    echo _n($token, $number);
}

class Karen
{
    static $language     = false;
    static $urlPrefix    = 'lang';
    static $cookiePrefix = 'karen_language';
    static $languagePath = '';
    static $textDomain   = 'default';
    static $library      = [];
    
    static function initialize($languagePath)
    {
        self::$languagePath = $languagePath;
        
        self::detect();
        self::loadLanguage();
    }
    
    static function getString($token)
    {
        return isset(self::$library[$token]) ? self::$library[$token] : $token;
    }
    
    
    static function validateISO($value)
    {
        return preg_match('/^[a-zA-Z]{2}(_[a-zA-Z]{2})?$/', $value);
    }
    
    
    static function loadLanguage()
    {
        $path = self::$languagePath . self::$language . '/' . self::$textDomain . '.php';

        if(file_exists($path))
        {
            require($path);
            
            self::$library = $library;
        }
    }
    
    static function textDomain($domainName = null)
    {
        self::$textDomain = $domainName;
        self::loadLanguage();
    }
    
    static function detect()
    {
        $url    = self::$urlPrefix;
        $cookie = self::$cookiePrefix;

        if(isset($_GET[$url]) && self::validateISO($_GET[$url]))
        {
{'fraction_non_alphanumeric': 0.16666666666666666, 'fraction_numerical': 0.0039548022598870055, 'mean_word_length': 2.340566037735849, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '861115', 'n_tokens_mistral': 1080, 'n_tokens_neox': 1093, 'n_words': 196}