<?php 

class language
{

    private static $literals = [];
    private static $default_lang = 'es'; // spanish default 
    private static $lang_large = ['es'=>'Spanish','en'=>'English'];

    public static function init($lang)
    {
        $path ='core/language/';
        $file_candidate = "lang.$lang.php";
        if(!is_file($path . $file_candidate)){
            $file_candidate = "lang." . self::$default_lang . ".php";
            $_SESSION['language']=self::$default_lang;
        }
        $large=self::$lang_large[$_SESSION['language']];
        $_SESSION['language_large']=$large;
        return $_SESSION['lang'] = (include $path . $file_candidate);
    }

}
?>