Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Community Cafe (http://www.bvlist.com/forumdisplay.php?f=18)
-   -   multi language mod (http://www.bvlist.com/showthread.php?t=4835)

Nw0nkNu 13th April 2010 08:36

multi language mod
 
Hi everyone!
I have found an multi language mod, but is incomplete.

First: class_language.php file added in include folder.
Code:


class trackerlanguage
{
    var $path;
    var $language;

    function set_path($path)
    {
        $this->path = $path;
    }

    function set_language($language="english")
    {       
        $language = str_replace(array("/", "\\", ".."), '', trim($language));
       
        if($language == "")
        {
            $language = "english";
        }
               
        $this->language = $language;
    }

    function load($section)
    {
        $lfile = $this->path."/".$this->language."/".$section.".lang.php";
        if(file_exists($lfile))
        {
            require_once $lfile;
        }
        else
        {
            die("$lfile does not exist");
        }
        if(isset($language) && is_array($language)) {
            foreach($language as $key => $val)
            {
                if(!isset($this->$key) || $this->$key != $val)
                {
                    $val = preg_replace("#\{([0-9]+)\}#", "%$1\$s", $val);
                    $this->$key = $val;
                }
            }
        }
    }   
}
?>

Next, in bittorrent.php i added:
Code:

require_once('class_language.php');

// Load Languages
$lang = new trackerlanguage;
$lang->set_path('/home/www/lang');
$lang->set_language($defaultlanguage);
$lang->load('global');

I created lang folder with english folder inside.
In english folder i have index.lang.php , browse.lang.php etc...

index.lang.php look like this:
Code:

if(!defined('IN_TRACKER'))
  die('Hacking attempt!');

//---------------index.php----------------
$language['index'] = array
(
    'error'                =>'Error',
    'denied'                =>'Permission denied!',

    'news'                =>'Recent News'
);
//---------------index.php----------------


?>

The problem is next: the script is working,but i don't know how to add another language and select him from profile...
For example i want to add romanian language, but how ?

If anyone have any idea please post.

Thanks!


All times are GMT +2. The time now is 03:01.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.