| [ Index ] |
PHP Cross Reference of GlotPress |
[Summary view] [Print] [Text view]
1 <?php 2 require_once dirname( dirname( __FILE__ ) ) . '/gp-load.php'; 3 4 class GP_Script_Export extends GP_Translation_Set_Script { 5 6 var $filter_options = array( 7 'f' => array( 'key' => 'term', 'desc' => 'search term' ), 8 'q' => array( 'key' => 'status', 'desc' => 'translation string status' ), 9 ); 10 11 function __construct() { 12 $this->short_options .= 'o:'; 13 $this->usage .= ' [-o <format (default=po)>]'; 14 $this->add_filters_to_options_and_usage(); 15 parent::__construct(); 16 } 17 18 function action_on_translation_set( $translation_set ) { 19 20 $format = gp_array_get( GP::$formats, isset( $this->options['o'] )? $this->options['o'] : 'po', null ); 21 if ( !$format ) $this->error( __('No such format.') );; 22 23 $entries = GP::$translation->for_export( $this->project, $translation_set, $this->get_filters_for_translation() ); 24 echo $format->print_exported_file( $this->project, $this->locale, $translation_set, $entries )."\n"; 25 } 26 27 function add_filters_to_options_and_usage() { 28 foreach( $this->filter_options as $option => $details ) { 29 $this->short_options .= "$option:"; 30 $this->usage .= " [-$option <{$details['desc']}>]"; 31 } 32 } 33 34 function get_filters_for_translation() { 35 $filters = array(); 36 foreach( $this->filter_options as $option => $option_details ) { 37 if ( isset( $this->options[$option] ) ) { 38 $filters[$option_details['key']] = $this->options[$option]; 39 } 40 } 41 return $filters; 42 } 43 } 44 $gp_script_export = new GP_Script_Export; 45 $gp_script_export->run();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu May 23 03:59:56 2013 | Hosted by follow the white rabbit. |