<?
$lg=new lang();

//where to get value
if (is_null($_REQUEST['language'])){
	$lg_val=$_SESSION['Xlanguage'];
} elseif(is_null($_SESSION['Xlanguage'])) {
	$lg_val=$_REQUEST['language'];
}else{
	$lg_val=$_SESSION['Xlanguage'];
}

//default value
if (is_null($lg_val)) {
	$lg_val="English";
}

//indentify language
if ($lg_val=="English"){
	$lg->lang_english();
} elseif ($lg_val=="B.Melayu"){
	$lg->lang_malay();
}

class lang{

	function lang_english(){
		//define('','');
		global $db_config;
		$urip=$_SERVER['REMOTE_ADDR'];
		
		/* database connection */
		define('_NoSuchCompany','No License granted under that Company code!');
		
		/* common */
		define('_Alert','['.$db_config['application'].' '.$db_config['version'].'] - Alert!\n-------------------------\n\n');
		define('_Congratulations','['.$db_config['application'].' '.$db_config['version'].'] - Congratulations!\n---------------------------------------\n\n');
		define('_Security','['.$db_config['application'].' '.$db_config['version'].'] - Security Warning!\n----------------------------------------\n\n');
		define('_Sorry','Sorry, ');
		define('_Security','Security,');
		define('_Sorry','Sorry,');
		
		define('_NewRow','\n');
		define('_Or','or ');
		define('_NoRecordFound','No Record Found! ');
		define('_Welcome','Welcome  ');
		define('_Yes','Yes ');
		define('_No','No ');
		define('_CompulsoryFieldBlank','*Compulsory field is blank ');
		define('_RecordAlreadyExist','Record already exist! ');
		define('_NotAssingedYet','Not assigned yet');
		define('_NoMatch','Your password did not match. Please re-enter!\nThank You ');
		define('_GoBackTo','Go back to ');
		define('_Save','Save');
		define('_Cancel','Cancel');
		define('_Add','Add ');
		define('_Update','Update');
		define('_EditUpdate','Edit & Update ');
		define('_Delete','Delete ');
		define('_Success','Success');
		define('_Failed','Failed');
		define('_ProcessCompleted','Process completed');
		
		/* Common Date */
		define('_DateRangeIsNotLogic','Date range is not logic');
		define('_PublicHoliday','Public Holiday');
		define('_NormalDay','Normal Day');
		define('_WeekendDay','Weekend Day');
		define('_PleaseCheckDayTypeAndGoThroughYourCalculationAgain','Please check Day Type and go through your calculation again');
		define('_January','January');
		define('_February','February');
		define('_March','March');
		define('_April','April');
		define('_May','May');
		define('_June','June');
		define('_July','July');
		define('_August','August');
		define('_September','September');
		define('_October','October');
		define('_November','November');
		define('_December','December');
		define('_Month','Month');
		define('_Year','Year');
		
		/* Security */
		define('_SecurityWarning','System had detected you accessing a restricted area from this location - ['.$urip.'] illegally.\n\nSystem will not tolerate with such behaviour.');
		define('_EngineBlowOff','Stand by mode [ON] ');
		define('_BugDetected','Bug Detected! ');
						
		/* Update Record */
		define('_UpdateSuccess','Your record was successfully updated ');
		define('_UpdateFail','Update failed! ');
		
		/* Add Record */
		define('_AddSuccess','Your record was successfully added ');
		define('_AddFail','Add failed! ');
		
		/* Delete Record */
		define('_DeleteQuery','Are you sure to delete this record? ');
		define('_DeleteSuccess','Your record was successfully deleted! ');
		define('_DeleteFail','Delete failed! ');
		define('_PleaseSelectRecord','Please select record before performing DELETE ');
		
		/* public*/
		define('_Compulsoryfield','Compulsory field');
	
		/* login */
		define('_NoSuchUserFound','No such user found! ');
		define('_WrongCombinationCompanyUsernamePassword','Wrong combination of Username & Password! ');
		
		// module audit trails
		define('_AuditTrailListing',"Audit Trail List");
		define('_AuditTrailReport',"Audit Trail Report");
		define('_IPAddress',"IP Address");
		define('_DateAndTime',"Date & Time");
		define('_ModuleInvolved',"Module Involved");
		define('_NoAuditTrailHistory',"No Audit Trail History");
		
		define('_TransactionDetails',"Transaction Details");
		define('_AuditTrailOperationDetails',"Audit Trail Operation Details");
		define('_Back',"Back");
		
		define('_AuditTrailDetails',"Audit Trail Details");
		define('_Transaction',"Transaction");
		define('_LinkTransactionDetails',"Transaction Details");
		define('_TransactionDetailsReport',"Transaction Details Report");
		
	}
	
	//----------------------------UTK TERJEMAHAN KE BAHASA MELAYU--------------
	function lang_malay(){
		global $db_config;
		$urip=$_SERVER['REMOTE_ADDR'];
		
		/* database connection */
		define('_NoSuchCompany','Syarikat anda tidak wujud didalam senarai!');
		
		/* common */
		define('_Alert','['.$db_config['application'].' '.$db_config['version'].'] - Perhatian!\n-------------------------\n\n');
		define('_Congratulations','['.$db_config['application'].' '.$db_config['version'].'] - Tahniah!\n---------------------------------------\n\n');
		define('_Security','['.$db_config['application'].' '.$db_config['version'].'] - Amaran Keselamatan!\n----------------------------------------\n\n');
		define('_Sorry','Maaf, ');
		define('_NewRow','\n');
		define('_Or','or ');
		define('_NoRecordFound','Tiada Rekod Yang Ditemui! ');
		define('_Welcome','Selamat Datang  ');
		define('_Yes','Ya ');
		define('_No','Tidak ');
		define('_CompulsoryFieldBlank','*Ruang Perlu Diisi ');
		define('_RecordAlreadyExist','Rekod Telah Ada! ');
		define('_NotAssingedYet','Belum ditetapkan lagi');
		define('_NoMatch','Katalaluan anda tidak sama. Sila isi kembali!\nTerima kasih ');
		define('_GoBackTo','Pergi semula ke ');
		define('_Save','Simpan');
		define('_Cancel','Batal');
		define('_Add','Tambah');
		define('_Update','Kemaskini');
		define('_EditUpdate','Pindaan & Kemaskini');
		define('_Delete','Hapus');
		define('_Success','Sukses');
		define('_Failed','Gagal');
		define('_ProcessCompleted','Proses telah dilaksanakan');
		
		/* Common Date */
		define('_DateRangeIsNotLogic','Tempoh Tarikh tidak logik');
		define('_PublicHoliday','Cuti Umum');
		define('_NormalDay','Hari Biasa');
		define('_WeekendDay','Hari Cuti Hujung Minggu');
		define('_January','Januari');
		define('_February','Februari');
		define('_March','Mac');
		define('_April','April');
		define('_May','Mei');
		define('_June','Jun');
		define('_July','Julai');
		define('_August','Ogos');
		define('_September','September');
		define('_October','Oktober');
		define('_November','November');
		define('_December','Disember');
		define('_Month','Bulan');
		define('_Year','Tahun');
		
		define('_Compulsoryfield',' Wajib diisi');	
		/* Security */
		define('_SecurityWarning','Sistem telah mengesan anda mengakses halaman yang tidak dibenarkan dari lokasi ini - ['.$urip.'] secara tidak sah.\n\nSistem tidak akan membenarkan anda memasukinya.');
		define('_EngineBlowOff','[Engine Blown Off] ');
				
		/* Update Record */
		define('_UpdateSuccess','Rekod anda telah berjaya dikemaskinikan ');
		define('_UpdateFail','Proses kemaskini tidak berjaya! ');
		
		/* Add Record */
		define('_AddSuccess','Rekod anda telah berjaya dimasukkan ');
		define('_AddFail','Penambahan data tidak berjaya! ');
		
		/* Delete Record */
		define('_DeleteQuery','Anda pasti ingin menghapuskan rekod ini? ');
		define('_DeleteSuccess','Rekod anda telah berjaya dihapuskan! ');
		define('_DeleteFail','Data gagal dihapuskan! ');
		define('_PleaseSelectRecord','Sila pilih rekod sebelum melakukan PENGHAPUSAN DATA ');
		
		/* Compulsory field*/
		define('_Compulsoryfield','Perlu diisikan');
				
		/* login */
		define('_NoSuchUserFound','Nama tiada dalam senarai! ');
		define('_WrongCombinationCompanyUsernamePassword','Kombinasi katanama dan katalaluan yang salah! ');
		
		// module Audit Trail
		define('_AuditTrailListing',"Senarai Audit Trail ");
		define('_AuditTrailReport',"Laporan Audit Trail");
		define('_IPAddress',"Alamat IP");
		define('_DateAndTime',"Tarikh & Masa");
		define('_ModuleInvolved',"Module Involved");
		define('_NoAuditTrailHistory',"Tiada Rekod Audit Trail");
		
		define('_TransactionDetails',"Butiran Transaksi");
		define('_AuditTrailOperationDetails',"Butiran Operasi Audit Trail ");
		define('_Back',"Back");
		
		define('_AuditTrailDetails',"Audit Trail Butiran");
		define('_Transaction',"Transaksi");
		define('_LinkTransactionDetails',"Butiran Transaksi");
		define('_TransactionDetailsReport',"Laporan Butiran Transaksi");
		
	}
	
}
?>