Bravo List
Register
Go Back   > Bravo List > P2P > Forum > Community Cafe
Notices

Reply
  #1  
Old 13th April 2010, 08:36
Nw0nkNu Nw0nkNu is offline
Member
 
Join Date: Nov 2008
Posts: 1
Default 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:
<?php

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:
<?php
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!
Reply With Quote
Reply

Tags
language , mod , multi

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 23:54. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2026, vBulletin Solutions Inc.