***************************************************************************/
require_once $opt['rootpath'] . 'lib2/translateAccess.php';
require_once $opt['rootpath'] . 'lib2/translationHandler.class.php';
function createTranslate($backtrace_level = 0)
{
    $access = new translateAccess();
    if ($access->hasAccess()) {
        global $cookie;
        $translateMode = $cookie->get('translate_mode');
        if ($translateMode) {
            return new translateEdit($translateMode == 'all', $backtrace_level);
        }
    }
    return new translate();
}
$translate = createTranslate();
class translate
{
    /* translate the given string
     */
    function t($message, $style, $resource_name, $line, $plural = '', $count = 1, $lang = null)
    {
        global $opt, $locale;
        // $locale is for lib1 compatibility
        if ($message == '') {
            return '';
        }
        if ($plural != '' && $count != 1) {
            $message = $plural;
        }
        $search = $this->prepare_text($message);
 public function translate($lang_string)
 {
     $translate = createTranslate(1);
     return $translate->t($lang_string, '', '', '');
 }