<?php

$mlang_messages=array();
$mlang_charsets=array();
##langmessages##;

// table captions

$tableCaptions = array();
##foreach @BUILDER.arrLanguageLabels as @l##
$tableCaptions["##@l.strLanguage s##"]=array();
	##foreach @l.arrTableLabels as @t##
$tableCaptions["##@l.strLanguage s##"]["##@t.strTableName g##"] = "##@t.strTableLabel 8s##";
	##endfor##
##endfor##


$mlang_defaultlang="##@BUILDER.strDefaultLanguage s##";
function mlang_getlanglist()
{
	global $mlang_messages,$mlang_defaultlang;
	return array_keys($mlang_messages);
}

function mlang_getcurrentlang()
{
	global $mlang_messages,$mlang_defaultlang;
	if(@$_SESSION["language"])
		return $_SESSION["language"];
	return $mlang_defaultlang;
}

function mlang_message($tag)
{
	global $mlang_messages,$mlang_defaultlang;
	return @$mlang_messages[mlang_getcurrentlang()][$tag];
}

function GetTableCaption($table)
{
	global $tableCaptions;
	return @$tableCaptions[mlang_getcurrentlang()][$table];
}

function GetFieldLabel($table,$field)
{
	global $field_labels;
	if(!array_key_exists($table,$field_labels))
		return "";
	return @$field_labels[$table][mlang_getcurrentlang()][$field];
}

function GetCustomLabel($custom)
{
	global $custom_labels;
	return @$custom_labels[mlang_getcurrentlang()][$custom];
}

?>