b2evolution PHP Cross Reference Blogging Systems

Source: /inc/locales/views/_translation.view.php - 105 lines - 3385 bytes - Summary - Text - Print

Description: This file implements the UI view for the translation editor. This file is part of the evoCore framework - {@link http://evocore.net/} See also {@link http://sourceforge.net/projects/evocms/}.

   1  <?php
   2  /**

   3   * This file implements the UI view for the translation editor.

   4   *

   5   * This file is part of the evoCore framework - {@link http://evocore.net/}

   6   * See also {@link http://sourceforge.net/projects/evocms/}.

   7   *

   8   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}

   9   *

  10   * @package admin

  11   *

  12   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}

  13   * @author fplanque: Francois PLANQUE.

  14   *

  15   * @version $Id: _translation.view.php 985 2012-03-05 21:59:17Z yura $

  16   */
  17  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  18  
  19  
  20  /**

  21   * @var User

  22   */
  23  global $current_User;
  24  
  25  global $edit_locale;
  26  
  27  $Form = new Form();
  28  
  29  $Form->begin_form( 'fform' );
  30  
  31  $Form->add_crumb( 'translation' );
  32  $Form->hidden( 'ctrl', 'translation' );
  33  $Form->hidden( 'edit_locale', $edit_locale );
  34  
  35  // Create query

  36  $SQL = new SQL();
  37  $SQL->SELECT( 'itst_ID, iost_string, itst_standard' );
  38  $SQL->FROM( 'T_i18n_original_string' );
  39  $SQL->FROM_add( 'RIGHT OUTER JOIN T_i18n_translated_string ON iost_ID = itst_iost_ID' );
  40  $SQL->WHERE( 'itst_locale = '.$DB->quote( $edit_locale ) );
  41  $SQL->ORDER_BY( '*, iost_string' );
  42  
  43  // Create a count sql

  44  $CountSQL = new SQL();
  45  $CountSQL->SELECT( 'SQL_NO_CACHE COUNT( itst_ID )' );
  46  $CountSQL->FROM( 'T_i18n_translated_string' );
  47  $CountSQL->WHERE( 'itst_locale = '.$DB->quote( $edit_locale ) );
  48  
  49  // Create result set:

  50  $Results = new Results( $SQL->get(), 'itst_', '-A'/*, NULL, $CountSQL->get()*/ );
  51  
  52  $Results->title = sprintf( T_('Translation editor for locale "%s"'), $edit_locale );
  53  
  54  $Results->global_icon( T_('Add new translated string...'), 'new', regenerate_url( '', 'action=new_strings' ), T_('Add new translated string').' &raquo;', 3, 4 );
  55  
  56  $Results->cols[] = array(
  57          'th' => T_('Original string'),
  58          'order' => 'iost_string',
  59          'td' => '%htmlspecialchars( #iost_string# )%',
  60      );
  61  
  62  $Results->cols[] = array(
  63          'th' => T_('Translated string'),
  64          'order' => 'itst_standard',
  65          'td' => '%htmlspecialchars( #itst_standard# )%',
  66      );
  67  
  68  function iost_td_actions( $translated_string_ID )
  69  {
  70      $r = action_icon( T_('Edit this string...'), 'edit',
  71                                          regenerate_url( 'action', 'itst_ID='.$translated_string_ID.'&amp;action=edit' ) );
  72      $r .= action_icon( T_('Delete this string!'), 'delete',
  73                                          regenerate_url( 'action', 'itst_ID='.$translated_string_ID.'&amp;action=delete&amp;'.url_crumb('translation') ) );
  74  
  75      return $r;
  76  }
  77  
  78  $Results->cols[] = array(
  79          'th' => T_('Actions'),
  80          'td' => '%iost_td_actions( #itst_ID# )%',
  81          'th_class' => 'shrinkwrap',
  82          'td_class' => 'shrinkwrap'
  83      );
  84  
  85  $Results->display();
  86  
  87  echo '<br />';
  88  
  89  if( $current_User->check_perm( 'options', 'edit' ) )
  90  {
  91      global $locales_path, $locales;
  92  
  93      $buttons = array();
  94      $buttons[] = array( 'submit', 'actionArray[import_pot]', T_('Import .POT file into DB'), 'SaveButton' );
  95      if( is_file( $locales_path.$locales[$edit_locale]['messages'].'/LC_MESSAGES/messages.po' ) )
  96      {
  97          $buttons[] = array( 'submit', 'actionArray[import_po]', T_('Import .PO file into DB'), 'SaveButton' );
  98      }
  99      $buttons[] = array( 'submit', 'actionArray[generate_pot]', T_('Generate .POT file'), 'SaveButton' );
 100      $buttons[] = array( 'submit', 'actionArray[generate_po]', T_('Generate .PO file'), 'SaveButton' );
 101  
 102      $Form->end_form( $buttons ) ;
 103  }
 104  
 105  ?>

title

Description

title

Description

title

Description

title

title

Body