Exemplo n.º 1
0
function ajax_translation_statistics() {
  global $ui_langs;
  $ret=array();

  translation_init();

  $ret['total']=array(
    "lang_str_count"=>sizeof(translation_statistics_load_lang("en")),
    "tags_count"=>sizeof(translation_statistics_load_tags("en"))+sizeof(translation_statistics_load_tags_missing()),
    "category_count"=>sizeof(translation_statistics_category_total()),
  );

  foreach($ui_langs as $lang) {
    $ret[$lang]=translation_statistics_lang($lang);
  }
  
  return $ret;
}
Exemplo n.º 2
0
  function save($changed, $param) {
    global $translation_path;
    global $current_user;
    translation_init();

    // no user ... return
    if($current_user->username=="")
      return "error:not_logged_in";

    if(!$changed)
      return;

    foreach($changed as $f=>$data) {
      if(preg_match("/^(php|tags|doc|category):(.*)$/", $f, $m)) {
	$mode=$m[1];
	$file=$m[2];
      }

      switch($mode) {
	case "php":
	  $this->write_file_php($file, $data);
	  break;
	case "tags":
	  $this->write_file_tags($file, $data);
	  break;
	case "doc":
	  $this->write_file_doc($file, $data);
	  break;
	case "category":
	  $this->write_file_category($file, $data, $param);
	  break;
      }
    }

    $this->update_language_list();

    chdir($translation_path);
    $author=$current_user->get_author();
    $msg=strtr($param['msg'], array("\""=>"\\\""));
    $p=popen("git commit --message=\"$msg\" --author=\"$author\"", "r");
    while($f=fgets($p)) /* do nothing */ ;
    pclose($p);

    return true;
  }