[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/scripts/ -> recheck-warnings.php (source)

   1  <?php
   2  require_once dirname( dirname( __FILE__ ) ) . '/gp-load.php';
   3  
   4  class GP_Script_Recheck_Warnings extends GP_Translation_Set_Script {
   5      
   6  	function action_on_translation_set( $translation_set ) {
   7          $project = GP::$project->get( $translation_set->project_id );
   8          $locale = GP_Locales::by_slug( $translation_set->locale );
   9          foreach( GP::$translation->for_translation( $project, $translation_set, 'no-limit' ) as $entry ) {
  10              $warnings = GP::$translation_warnings->check( $entry->singular, $entry->plural, $entry->translations, $locale );
  11              if ( $warnings != $entry->warnings ) {
  12                  $translation = new GP_Translation( array('id' => $entry->id) );
  13                  echo sprintf( __("Updating warnings for %s"), $entry->id ) . "\n";
  14                  $translation->update( array('warnings' => $warnings) );
  15              }
  16          }
  17      }
  18      
  19  }
  20  $gp_script_recheck_warnings = new GP_Script_Recheck_Warnings;
  21  $gp_script_recheck_warnings->run();


Generated: Thu May 24 03:59:35 2012 Hosted by follow the white rabbit.