--- a
+++ b/g.php
@@ -0,0 +1,228 @@
+<?php
+//php g.php &&  
+
+
+
+
+ 
+$list[]='index.shtml';//repair
+$list[]='news.html';
+$list[]='ssi/menu.html';
+$list[]='releases/index.shtml';
+/*
+$list[]='releases/2010.4.0/en.shtml';
+$list[]='releases/2010.2.0/en.shtml';
+$list[]='releases/2009.4.0/en.shtml';
+$list[]='releases/2009.2.0/en.shtml';
+$list[]='releases/2010.0.0/en.shtml';
+$list[]='releases/2010.0.0/en.shtml';
+$list[]='releases/0.8.0/en.shtml';
+$list[]='releases/0.7.0/en.shtml';
+*/
+$list[]='download/index.shtml';
+$list[]='screenshots/index.shtml';
+$list[]='tutorials/index.shtml';
+
+$list[]='tutorials/architectural/en.shtml';
+$list[]='tutorials/Blend-masks/en.shtml';
+$list[]='tutorials/enblend-svg/en.shtml';
+$list[]='tutorials/multi-lens/en.shtml';
+$list[]='tutorials/overview/en.shtml';
+$list[]='tutorials/scans/en.shtml';
+$list[]='tutorials/tca/en.shtml';
+$list[]='tutorials/auto-exposure/en.shtml';
+$list[]='tutorials/calibration/en.shtml';
+$list[]='tutorials/enfuse-360/en.shtml';
+$list[]='tutorials/Mosaic-mode/en.shtml';
+$list[]='tutorials/multi-row/en.shtml';
+$list[]='tutorials/perspective/en.shtml';
+$list[]='tutorials/surveying/en.shtml';
+$list[]='tutorials/two-photos/en.shtml';
+
+
+
+$list[]='docs/index.shtml';
+$list[]='tech/index.shtml';//repair
+$list[]='links/index.shtml';
+
+$list[]='community/index.shtml';
+$list[]='community/authors/index.shtml';
+$list[]='community/charter/index.shtml';//repair
+
+$minimal_list=array(
+	'index.shtml',
+	'news.html',
+	'ssi/menu.html',
+	'releases/index.shtml');
+
+
+$Languages=array(
+  'cs'=>array(
+    'language'=>'cs',
+    'codeset'=>'cs_CZ.UTF-8',
+    'pages'=>$minimal_list, //pages to translate by gettext
+    'translated-pages'=>array(  //before gettext translations
+      'releases/2011.2.0/en.shtml'=>'releases/2011.2.0/cs.shtml',
+      'releases/2010.0.0/en.shtml'=>'releases/2010.0.0/cs.shtml',
+      'releases/2009.4.0/en.shtml'=>'releases/2009.4.0/cs.shtml',
+      'releases/2009.2.0/en.shtml'=>'releases/2009.2.0/cs.shtml'
+    )
+  ),
+  'de'=>array(
+    'language'=>'de',
+    'codeset'=>'de_DE.UTF-8',
+    'pages'=>$minimal_list,
+    'translated-pages'=>array(
+      'releases/2010.0.0/en.shtml'=>'releases/2010.0.0/de.shtml',
+      'releases/2010.4.0/en.shtml'=>'releases/2010.4.0/de.shtml',
+      'releases/2009.2.0/en.shtml'=>'releases/2009.2.0/de.shtml',
+      'releases/2011.2.0/en.shtml'=>'releases/2011.2.0/de.shtml',
+      'releases/2010.2.0/en.shtml'=>'releases/2010.2.0/de.shtml',
+      'releases/0.8.0/en.shtml'=>'releases/0.8.0/de.shtml',
+      'releases/2011.0.0/en.shtml'=>'releases/2011.0.0/de.shtml',
+      'releases/2009.4.0/en.shtml'=>'releases/2009.4.0/de.shtml'
+    )
+));
+
+require_once 'JSLikeHTMLElement.php';
+
+
+Foreach($Languages as $LangId =>$Lang){
+  exec('msgfmt translation/'.$Lang['language'].'/LC_MESSAGES/messages.po');
+
+  // translation domain
+  $domain = "messages";
+
+  // affects directory
+  putenv ( "LANG=" . $Lang['language'] );
+
+  bind_textdomain_codeset($domain, "UTF8");
+  // language neviroment
+  setlocale(LC_ALL,$Lang['codeset']);
+
+  // dir with localization
+  bindtextdomain($domain, realpath("translation"));
+
+  // runs domain with translations
+  textdomain($domain);
+
+  $catalog=fopen('translation/'.$Lang['language'].'/LC_MESSAGES/catalog.pot','w+');
+  fwrite($catalog,
+'# Hugin web translation
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: https://launchpad.net/hugin"
+"\n"
+"POT-Creation-Date: 2011-06-19 17:11-0400\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+');
+
+
+  foreach ($Lang['pages'] as $file){
+    if(!isset($Languages[$LangId]['translated-pages'][$file]))
+      {
+	if(substr($file,-6)=='.shtml'){
+	  $newfilename=str_replace('.shtml','.'.$Lang['language'].'.shtml',$file);
+	}elseif(substr($file,-5)=='.html'){
+	  $newfilename=str_replace('.html','.'.$Lang['language'].'.html',$file);
+	}
+	HandleFile($file,$newfilename);
+	$Languages[$LangId]['translated-pages'][$file]=$newfilename;
+      }
+    
+  }
+fclose($catalog);
+
+  exec('msguniq translation/'.$Lang['language'].'/LC_MESSAGES/catalog.pot   > translation/'.$Lang['language'].'/LC_MESSAGES/catalog-u.pot');
+  if (file_exists('translation/'.$Lang['language'].'/LC_MESSAGES/messages.po')){
+    exec('msgmerge -U translation/'.$Lang['language'].'/LC_MESSAGES/messages.po    translation/'.$Lang['language'].'/LC_MESSAGES/catalog-u.pot');
+  }else{
+    exec('msginit -o translation/'.$Lang['language'].'/LC_MESSAGES/messages.po   -i translation/'.$Lang['language'].'/LC_MESSAGES/catalog-u.pot --no-translator -l'.$Lang['codeset']);
+  }
+
+
+}
+
+
+function HandleFile($Filename,$NewFilename){
+  global $catalog;
+
+  $dom_doc = new DOMDocument();
+  $dom_doc->registerNodeClass('DOMElement', 'JSLikeHTMLElement');
+  $html_file = file_get_contents($Filename);
+  // The next line will likely generate lots of warnings if your html isn't perfect
+  // Put an @ in front to suppress the warnings once you review them
+  $dom_doc->loadHTML( $html_file );
+
+  foreach(array('p','h1','h2','h3','title','li') as $tagname) {
+    $tags = $dom_doc->getElementsByTagName($tagname);
+    // Extract text value and replace with something else
+    foreach($tags as $tag) {
+      $tag_value = trim($tag->innerHTML);
+
+     
+
+if($tag_value!=''){
+
+      fwrite($catalog,"\n". 
+		      '#:'.$Filename."\n");
+  $rows=explode("\n",$tag_value);
+  $cnt=count($rows);
+  if($cnt>1){
+    fwrite($catalog, 'msgid ""'."\n");
+    $i=1;
+  foreach($rows as $row){
+    fwrite($catalog, '    "'.str_replace('"','\"',$row) .($i==$cnt?'':'\n').'"'."\n");
+    $i++;
+  }
+
+
+
+  }else{
+  
+    fwrite($catalog, 'msgid "'.str_replace('"','\"',$tag_value) .'"'."\n");
+  
+  }
+
+
+  
+
+  fwrite($catalog,'msgstr ""'."\n");
+}
+
+
+      $k=gettext($tag_value);
+      $tag->innerHTML=$k;
+	
+    }
+  
+  
+
+  }
+  // save page with translated text
+  $translated_page = $dom_doc->saveHTML();
+  
+
+  file_put_contents($NewFilename,$translated_page);
+  //echo $translated_page;
+  
+}
+
+
+
+
+
+
+
+
+
+
+
+
+