Index: /trunk/calendar/setup/phpgw_alarm_pt-br.lang
===================================================================
--- /trunk/calendar/setup/phpgw_alarm_pt-br.lang	(revision 204)
+++ /trunk/calendar/setup/phpgw_alarm_pt-br.lang	(revision 204)
@@ -0,0 +1,22 @@
+Title	calendar	pt-br	Título
+Description	calendar	pt-br	Descrição
+External Participants	calendar	es-es	Participantes Externos
+Category	calendar	pt-br	Categoria
+Location	calendar	pt-br	Lugar
+Start Date/Time	calendar	pt-br	Data/Hora Início
+End Date/Time	calendar	pt-br	Data/Hora de Término
+Low	calendar	pt-br	Baixa
+Normal	calendar	pt-br	Normal
+High	calendar	pt-br	Alta
+Priority	calendar	pt-br	Prioridade
+Created By	calendar	pt-br	Criado por
+Updated	calendar	pt-br	Atualizado
+Access	calendar	pt-br	Acesso
+Groups	calendar	pt-br	Grupos
+Participants	calendar	pt-br	Participantes
+Alarm for %1 at %2 in %3	calendar	pt-br	Alarme para %1 em %2 na %3
+Here is your requested alarm.	calendar	pt-br	Aqui está seu alarme solicitado.
+You have a meeting scheduled for %1	calendar	pt-br	Você possui um compromisso agendado para %1.
+Your meeting scheduled for %1 has been canceled	calendar	pt-br	Seu compromisso agendado para %1 foi cancelado.
+Your meeting that had been scheduled for %1 has been rescheduled to %2	calendar	pt-br	Seu compromisso que havia sido agendado para %1 foi reagendado para %2
+
Index: /trunk/calendar/setup/setup.inc.php
===================================================================
--- /trunk/calendar/setup/setup.inc.php	(revision 134)
+++ /trunk/calendar/setup/setup.inc.php	(revision 204)
@@ -12,5 +12,5 @@
 
 	$setup_info['calendar']['name']    = 'calendar';
-	$setup_info['calendar']['version'] = '0.9.21';
+	$setup_info['calendar']['version'] = '0.9.22';
 	$setup_info['calendar']['app_order'] = 3;
 	$setup_info['calendar']['enable']  = 1;
Index: /trunk/calendar/setup/tables_update.inc.php
===================================================================
--- /trunk/calendar/setup/tables_update.inc.php	(revision 166)
+++ /trunk/calendar/setup/tables_update.inc.php	(revision 204)
@@ -20,4 +20,30 @@
 		$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.21';
 		return $GLOBALS['setup_info']['calendar']['currentver'];
+	}
+	$test[] = '0.9.20';
+	function calendar_upgrade0_9_20()
+	{
+		$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.21';
+		return $GLOBALS['setup_info']['calendar']['currentver'];
 	}	
+	$test[] = '0.9.21';
+	function calendar_upgrade0_9_21()
+	{
+		/*
+		$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_cal','last_status',array(
+			'type' => 'char',
+			'precision' => '1',
+			'default' => 'N::bpchar'));
+		$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_cal','last_update',array(
+			'type' => 'int8',
+			'precision' => '8',
+			'default' => '(date_part(\'epoch\'::text, (\'now\'::text)::timestamp(3) with time zone) * (1000)::double precision)'));
+		*/
+		$GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cal ADD COLUMN last_status char(1) DEFAULT 'N'::bpchar");
+		$GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cal ADD COLUMN last_update int8 DEFAULT (date_part('epoch'::text, ('now'::text)::timestamp(3) with time zone) * (1000)::double precision)");
+
+		$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.22';
+		return $GLOBALS['setup_info']['calendar']['currentver'];
+	}
+
 ?>
Index: /trunk/calendar/setup/phpgw_alarm_es-es.lang
===================================================================
--- /trunk/calendar/setup/phpgw_alarm_es-es.lang	(revision 204)
+++ /trunk/calendar/setup/phpgw_alarm_es-es.lang	(revision 204)
@@ -0,0 +1,18 @@
+Title	calendar	es-es	Titulo
+Description	calendar	es-es	descripción
+External Participants	calendar	es-es	Participantes Externos
+Category	calendar	es-es	Categoria
+Location	calendar	es-es	Lugar
+Start Date/Time	calendar	es-es	Fecha/Hora Inicio
+End Date/Time	calendar	es-es	La fecha/hora de finalización
+Low	calendar	es-es	Baixa
+Normal	calendar	es-es	Normal
+High	calendar	es-es	Alta
+Priority	calendar	es-es	Prioridad
+Created By	calendar	es-es	Creado por
+Updated	calendar	es-es	Actualizado
+Access	calendar	es-es	Acesso
+Groups	calendar	es-es	Grupos
+Participants	calendar	es-es	Participantes
+here is your requested alarm.	calendar	es-es	Aquí está la alarma solicitada.
+Alarm for %1 at %2 in %3	calendar	es-es	Alarma para %1 en %2 in %3
Index: /trunk/calendar/inc/class.uiholiday.inc.php
===================================================================
--- /trunk/calendar/inc/class.uiholiday.inc.php	(revision 2)
+++ /trunk/calendar/inc/class.uiholiday.inc.php	(revision 204)
@@ -384,5 +384,5 @@
 			$p->set_file(Array('form'=>'delete_common.tpl','form_button'=>'form_button_script.tpl'));
 		
-			$p->set_var('messages',lang('Are you sure you want to delete this Country ?')."<br>".$this->bo->locales[0]);
+			$p->set_var('messages',lang('Are you sure want to delete this Country?')."<br>".$this->bo->locales[0]);
 
 			$var = Array(
@@ -424,5 +424,5 @@
 			$p->set_file(Array('form'=>'delete_common.tpl','form_button'=>'form_button_script.tpl'));
 		
-			$p->set_var('messages',lang('Are you sure you want to delete this holiday ?')."<br>".$holiday['name'].' ('.$this->bo->locales[0].') '.$this->bo->rule_string($holiday));
+			$p->set_var('messages',lang('Are you sure want to delete this holiday?')."<br>".$holiday['name'].' ('.$this->bo->locales[0].') '.$this->bo->rule_string($holiday));
 
 			$var = Array(
Index: /trunk/calendar/inc/class.bocalendar.inc.php
===================================================================
--- /trunk/calendar/inc/class.bocalendar.inc.php	(revision 166)
+++ /trunk/calendar/inc/class.bocalendar.inc.php	(revision 204)
@@ -138,4 +138,5 @@
 		var $num_months;
 		var $xmlrpc = False;	// not called via xmlrpc
+       	var $async = false;
 
 		function bocalendar($session=0)
@@ -168,4 +169,9 @@
 			print_debug('BO Filter',$this->filter);
 			print_debug('Owner',$this->owner);
+
+			if ($GLOBALS['argv']) {
+			  $this->async = true;
+			  $this->load_lang();
+			}
 
 			$this->prefs['calendar']    = $GLOBALS['phpgw_info']['user']['preferences']['calendar'];
@@ -368,4 +374,20 @@
 		}
 
+	  function load_lang() {
+	    if(!$_SESSION['phpgw_info']['calendar']['langAlarm']) 
+	      {
+		$array_keys = array();
+		$fn = '../../calendar/setup/phpgw_alarm_'.$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'].'.lang';			
+		echo $fn;
+		if (file_exists($fn)){
+		  $fp = fopen($fn,'r');
+		  while ($data = fgets($fp,16000))	{
+		    list($message_id,$app_name,$null,$content) = explode("\t",substr($data,0,-1));			
+		    $_SESSION['phpgw_info']['calendar']['langAlarm'][$message_id] =  $content;
+		  }
+		  fclose($fp);
+		}
+	      }
+	  }
 		function list_methods($_type='xmlrpc')
 		{
@@ -2990,5 +3012,5 @@
 					if (!$returncode)	// not nice, but better than failing silently
 					{
-						echo '<p><b>bocalendar::send_update</b>: '.lang("Failed sending message to '%1' #%2 subject='%3', sender='%4' !!!",$to,$userid,htmlspecialchars($subject), $sender)."<br>\n";
+						echo '<p><b>bocalendar::send_update</b>: '.lang("Failed sending message to '%1' #%2 subject='%3', sender='%4'!!!",$to,$userid,htmlspecialchars($subject), $sender)."<br>\n";
 						echo '<i>'.$mail->ErrorInfo."</i><br>\n";
 						echo lang('This is mostly caused by a not or wrongly configured SMTP server. Notify your administrator.')."</p>\n";
@@ -3323,4 +3345,11 @@
 		}
 
+	  function translate($key,$vars=false, $not_found='*' )
+	  {
+    	    if ($this->async)
+	      return $GLOBALS['phpgw']->translation->translate_async($key, $vars);
+	    return lang($key, $vars);
+	  }
+
 		/*!
 		@function event2array
@@ -3333,6 +3362,6 @@
 		function event2array($event)
 		{
-			$var['title'] = Array(
-				'field'		=> lang('Title'),
+		  $var['title'] = Array(
+				'field'		=> $this->translate('Title'),
 				'data'		=> $event['title']
 			);
@@ -3341,10 +3370,10 @@
 			// this will be printed even though its not needed.
 			$var['description'] = Array(
-				'field'	=> lang('Description'),
+				'field'	=> $this->translate('Description'),
 				'data'	=> $event['description']
 			);
 
 			$var['ex_participants'] = Array(
-				'field'	=> lang('External Participants'),
+				'field'	=> $this->translate('External Participants'),
 				'data'	=> $event['ex_participants']
 			);
@@ -3366,20 +3395,20 @@
 			}
 			$var['category'] = Array(
-				'field'	=> lang('Category'),
+				'field'	=> $this->translate('Category'),
 				'data'	=> implode(', ',$cat_string)
 			);
 
 			$var['location'] = Array(
-				'field'	=> lang('Location'),
+				'field'	=> $this->translate('Location'),
 				'data'	=> $event['location']
 			);
 
 			$var['startdate'] = Array(
-				'field'	=> lang('Start Date/Time'),
+				'field'	=> $this->translate('Start Date/Time'),
 				'data'	=> $GLOBALS['phpgw']->common->show_date($this->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset),
 			);
 
 			$var['enddate'] = Array(
-				'field'	=> lang('End Date/Time'),
+				'field'	=> $this->translate('End Date/Time'),
 				'data'	=> $GLOBALS['phpgw']->common->show_date($this->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset)
 			);
@@ -3436,5 +3465,5 @@
 			}
 			$var['participants'] = Array(
-				'field'	=> lang('Participants'),
+				'field'	=> $this->translate('Participants'),
 				'data'	=> $participants
 			);
@@ -3535,5 +3564,5 @@
 			//$default_prefs = $GLOBALS['phpgw']->preferences->default['calendar']; jakjr
 
-			$subject = lang('Calendar Event') . ' - $$action$$: $$startdate$$ $$title$$'."\n";
+			$subject = $this->translate('Calendar Event') . ' - $$action$$: $$startdate$$ $$title$$'."\n";
 			$defaults = array(
 				'defaultcalendar' => 'week',
@@ -3542,9 +3571,9 @@
 				'receive_updates' => 'no',
 				'update_format'   => 'extended',	// leave it to extended for now, as iCal kills the message-body
-				'notifyAdded'     => $subject . lang ('You have a meeting scheduled for %1','$$startdate$$'),
-				'notifyCanceled'  => $subject . lang ('Your meeting scheduled for %1 has been canceled','$$startdate$$'),
-				'notifyModified'  => $subject . lang ('Your meeting that had been scheduled for %1 has been rescheduled to %2','$$olddate$$','$$startdate$$'),
-				'notifyResponse'  => $subject . lang ('On %1 %2 %3 your meeting request for %4','$$date$$','$$fullname$$','$$action$$','$$startdate$$'),
-				'notifyAlarm'     => lang('Alarm for %1 at %2 in %3','$$title$$','$$startdate$$','$$location$$')."\n".lang ('Here is your requested alarm.'),
+				'notifyAdded'     => $subject . $this->translate ('You have a meeting scheduled for %1',array('$$startdate$$')),
+				'notifyCanceled'  => $subject . $this->translate ('Your meeting scheduled for %1 has been canceled',array('$$startdate$$')),
+				'notifyModified'  => $subject . $this->translate ('Your meeting that had been scheduled for %1 has been rescheduled to %2',array('$$olddate$$','$$startdate$$')),
+				'notifyResponse'  => $subject . $this->translate ('On %1 %2 %3 your meeting request for %4', array('$$date$$','$$fullname$$','$$action$$','$$startdate$$')),
+				'notifyAlarm'     => $this->translate('Alarm for %1 at %2 in %3',array('$$title$$','$$startdate$$','$$location$$')) . "\n" . $this->translate('Here is your requested alarm.'),
 				'show_rejected'   => '0',
 				'display_status'  => '1',
Index: /trunk/calendar/inc/class.uialarm.inc.php
===================================================================
--- /trunk/calendar/inc/class.uialarm.inc.php	(revision 29)
+++ /trunk/calendar/inc/class.uialarm.inc.php	(revision 204)
@@ -202,5 +202,5 @@
 				if ($to_delete)
 				{
-					$this->template->set_var('delete_button',$this->html->submit_button('delete','Delete',"return confirm('".lang("Are you sure\\nyou want to\\ndelete these alarms?")."')"));
+					$this->template->set_var('delete_button',$this->html->submit_button('delete','Delete',"return confirm('".lang("Are you sure want to delete these alarms?")."')"));
 				}
 				$this->template->parse('rows','buttons',True);
Index: /trunk/calendar/inc/lang_alarm.php
===================================================================
--- /trunk/calendar/inc/lang_alarm.php	(revision 204)
+++ /trunk/calendar/inc/lang_alarm.php	(revision 204)
@@ -0,0 +1,18 @@
+<?
+function load_lang() {
+	if(!$_SESSION['phpgw_info']['calendar']['langAlarm']) 
+	{
+		$array_keys = array();
+		$fn = '../setup/phpgw_alarm_'.$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'].'.lang';			
+		echo $fn;
+		if (file_exists($fn)){
+			$fp = fopen($fn,'r');
+			while ($data = fgets($fp,16000))	{
+				list($message_id,$app_name,$null,$content) = explode("\t",substr($data,0,-1));			
+				$_SESSION['phpgw_info']['calendar']['langAlarm'][$message_id] =  $content;
+			}
+			fclose($fp);
+		}
+	}
+}
+?>
Index: /trunk/calendar/inc/class.socalendar_sql.inc.php
===================================================================
--- /trunk/calendar/inc/class.socalendar_sql.inc.php	(revision 86)
+++ /trunk/calendar/inc/class.socalendar_sql.inc.php	(revision 204)
@@ -607,4 +607,5 @@
 					. $event['category']."')",__LINE__,__FILE__);
 				$event['id'] = $this->stream->get_last_insert_id('phpgw_cal','cal_id');
+				$last_status = true;
 			}
 
@@ -637,4 +638,5 @@
 					. ($event['groups']?"groups='".(count($event['groups'])>1?implode(',',$event['groups']):','.$event['groups'][0].',')."', ":'')
 					. 'reference='.(int)$event['reference'].' '
+					. ',last_status = '.($last_status ? "'N'" : "'U'").',last_update = '.time()."000". ' '
 					. 'WHERE cal_id='.(int)$event['id'];
 
Index: /trunk/calendar/inc/class.uicalendar.inc.php
===================================================================
--- /trunk/calendar/inc/class.uicalendar.inc.php	(revision 57)
+++ /trunk/calendar/inc/class.uicalendar.inc.php	(revision 204)
@@ -843,5 +843,5 @@
 						'action_url_button'	=> $this->page('delete','&cal_id='.$cal_id),
 						'action_text_button'	=> lang('Delete Single'),
-						'action_confirm_button'	=> "onClick=\"return confirm('".lang("Are you sure\\nyou want to\\ndelete this single occurence ?\\n\\nThis will delete\\nthis entry for all users.")."')\"",
+						'action_confirm_button'	=> "onClick=\"return confirm('".lang('Are you sure want to delete this single occurence?\\nThis will delete this entry for all users.')."')\"",
 						'action_extra_field'	=> $this->html->input_hidden(array(
 							'delete_type' => 'single',
@@ -855,5 +855,5 @@
 						'action_url_button'	=> $this->page('delete','&cal_id='.$cal_id),
 						'action_text_button'	=> lang('Delete Series'),
-						'action_confirm_button'	=> "onClick=\"return confirm('".lang("Are you sure\\nyou want to\\ndelete this entry ?\\n\\nThis will delete\\nthis entry for all users.")."')\"",
+						'action_confirm_button'	=> "onClick=\"return confirm('".lang('Are you sure want to delete this entry?\\nThis will delete this entry for all users.')."')\"",
 						'action_extra_field'	=> $this->html->input_hidden('delete_type','series')
 					);
@@ -878,5 +878,5 @@
 						'action_url_button'	=> $this->page('delete','&cal_id='.$cal_id),
 						'action_text_button'	=> lang('Delete'),
-						'action_confirm_button'	=> "onClick=\"return confirm('".lang("Are you sure\\nyou want to\\ndelete this entry ?\\n\\nThis will delete\\nthis entry for all users.")."')\"",
+						'action_confirm_button'	=> "onClick=\"return confirm('".lang('Are you sure want to delete this entry?\\nThis will delete this entry for all users.')."')\"",
 						'action_extra_field'	=> ''
 					);
@@ -3825,5 +3825,5 @@
 			$GLOBALS['phpgw_info']['flags']['noappheader'] = True;
 			$GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
-			$GLOBALS['phpgw_info']['flags']['app_header'] = $event['id'] ? lang('Calendar - Edit') : lang('Calendar - Add');
+			$GLOBALS['phpgw_info']['flags']['app_header'] = $event['id'] ? lang('Editing event') : lang('Adding event');
 			$GLOBALS['phpgw']->common->phpgw_header();
 
@@ -4085,5 +4085,5 @@
 											'	<br>'.lang("Search for").':'.
 											'	<input value="" id="cal_input_searchUser" size="35" autocomplete="off" onkeyup="javascript:optionFinderTimeout(this)"><br>'.
-											'	<b>'.lang("Available Users and Groups").'</b>'.
+											'	<b>'.lang("Available users and groups").'</b>'.
 											'	<select id="user_list_in" style="width: 300px" multiple size="13"></select>'.
 											'</td>'.
@@ -4343,5 +4343,5 @@
 					'action_url_button'	=> $this->page('delete','&cal_id='.$event['id']),
 					'action_text_button'	=> lang('Delete'),
-					'action_confirm_button'	=> "onClick=\"return confirm('".lang("Are you sure\\nyou want to\\ndelete this entry ?\\n\\nThis will delete\\nthis entry for all users.")."')\"",
+					'action_confirm_button'	=> "onClick=\"return confirm('".lang('Are you sure want to delete this entry?\\nThis will delete this entry for all users.')."')\"",
 					'action_extra_field'	=> ''
 				);
Index: /trunk/calendar/csv_import.php
===================================================================
--- /trunk/calendar/csv_import.php	(revision 2)
+++ /trunk/calendar/csv_import.php	(revision 204)
@@ -243,5 +243,5 @@
 			"usefull for the last pair, as they are worked from left to right.<p>".
 			"First example: <b>1${ASep}private${PSep}public</b><br>".
-			"This will translate a '1' in the CVS field to 'privat' and everything else to 'public'.<p>".
+			"This will translate a '1' in the CVS field to 'private' and everything else to 'public'.<p>".
 			"Patterns as well as the replacement can be regular expressions (the replacement is done via ereg_replace). ".
 			"If, after all replacements, the value starts with an '@' the whole value is eval()'ed, so you ".
