Bravo List
Register
Go Back   > Bravo List > P2P > Forum > Community Cafe
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Torrent Strike-Multi aka MultiStrike sharpe Torrent Strike 9 6th October 2012 12:20
TS v5.4 Turkish Language xcore Template Shares 3 24th March 2012 14:22
[TT & H-Tracker] LV Language wMan Mods & Themes 3 19th May 2009 12:46
Language Italian alex.delpiero8 Torrent Strike 3 25th April 2009 02:12
Multi-tracker mhmd_1983 Template Shares 7 21st November 2008 22:39



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