Language.class.php 602 Bytes
<?php

class Lib_Helper_Language
{
    public static function t($text, $language = 'zh-cn', $module = 'web')
    {
        if (!in_array($module, array('web', 'mobile')))
        {
            $module = 'web';
        }
        
        $language_file = dirname(__FILE__).'/../../languages/'.$module.'/'.$language.'.php';
        
        if (!file_exists($language_file))
        {
            $language_file = dirname(__FILE__).'/../../languages/'.$module.'/zh-cn.php';
        }
    	$resource = include($language_file);
    	
    	return isset($resource[$text]) ? $resource[$text] : $text;
    }
}