Initial checkin
This commit is contained in:
commit
d75eb444fc
4304 changed files with 369634 additions and 0 deletions
82
inc/lang.class.php
Normal file
82
inc/lang.class.php
Normal file
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
/**
|
||||
* Project: astat - simple site engine
|
||||
* File: /inc/lang.class.php
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* @link http://www.astat.org SVN: $URL: $
|
||||
* @copyright 2025 becast.at
|
||||
* @author Bernhard Jaud <bernhard at becast dot at>
|
||||
* @package astat core
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
$module["lang"]["name"]="Language Class";
|
||||
$module["lang"]["ver"]="0.1.1";
|
||||
|
||||
class lang{
|
||||
var $langname=array('de'=>'Deutsch','en'=>'English');
|
||||
var $language;
|
||||
var $languagedir;
|
||||
var $lf;
|
||||
|
||||
function __construct($languagedir='/languages/'){
|
||||
$this->languagedir = dirname(dirname(__FILE__)).'/languages/';
|
||||
}
|
||||
|
||||
function setlang($language){
|
||||
global $config, $error, $db, $log, $core, $plugin, $lang;
|
||||
unset($this->language);
|
||||
unset($this->lf);
|
||||
if(!$language || $language==''){
|
||||
$language=$config['lang'];
|
||||
if(!$language){
|
||||
$this->language='en';
|
||||
}else{
|
||||
$this->language=$language;
|
||||
}
|
||||
}else{
|
||||
$this->language=$language;
|
||||
}
|
||||
include_once $this->languagedir.$this->language.'.lang.php';
|
||||
$this->lf=$lf;
|
||||
}
|
||||
|
||||
function getlanguages(){
|
||||
$langdir = $this->languagedir;
|
||||
$langs = opendir($langdir);
|
||||
$i=0;
|
||||
while ($lang = readdir($langs)) {
|
||||
if (preg_match('/^.*?\.lang.php$/', $lang)) {
|
||||
$langfile[$i]['short']=substr($lang,0,2);
|
||||
$langfile[$i]['name']=$this->langname[$langfile[$i]['short']];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@closedir($langs);
|
||||
return($langfile);
|
||||
}
|
||||
|
||||
function _($string){
|
||||
if(isset($this->lf[$string])){
|
||||
return($this->lf[$string]);
|
||||
}else{
|
||||
return($string);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue