languages
[ class tree: languages ] [ index: languages ] [ all elements ]

Source for file translate_strings.php

Documentation is available at translate_strings.php

  1. <?php
  2. /**
  3.  * @package languages
  4.  * @subpackage functions
  5.  * @version $Header$
  6.  *
  7.  *  Copyright (c) 2005 bitweaver.org
  8.  *  Copyright (c) 2004-2005, Christian Fowler, et. al.
  9.  *  All Rights Reserved. See below for details and a complete list of authors.
  10.  *  Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
  11.  */
  12.  
  13. /**
  14.  * Initialization
  15.  */
  16. require_once'../kernel/setup_inc.php' );
  17.  
  18. $gBitSystem->verifyPermission'p_languages_edit' );
  19.  
  20. // Get available languages from DB
  21. $languages $gBitLanguage->listLanguages();
  22. $gBitSmarty->assign_by_ref('languages'$languages);
  23.  
  24. if!empty$_REQUEST['all_trans') ) {
  25.     $gBitSmarty->assign'allTrans');
  26. }
  27.  
  28. if!empty$_REQUEST['un_trans') ) {
  29.     $gBitSmarty->assign'unTrans');
  30. }
  31.  
  32.  
  33. ifisset$_REQUEST['save_translations') ) {
  34.     $editLang $_REQUEST['lang'];
  35.     $gBitLanguage->loadLanguage$editLang );
  36.     $storedStrings NULL;
  37.     foreach$_REQUEST['edit_trans'as $sourceHash => $string {
  38.         if$string != $gBitLanguage->mStrings[$editLang][$sourceHash]['trans'{
  39.             // we need to remove the $_REQUEST slashes here to avoid stuff like: 
  40.             // {$gBitSystem->getConfig(\'stuff\')} in the translated strings - 
  41.             // it will kill the site since smarty won't be able to interpret 
  42.             // the template anymore --xing
  43.             ifini_get'magic_quotes_gpc' ) ) {
  44.                 $string stripslashes$string );
  45.             }
  46.             $gBitLanguage->storeTranslationString$editLang$string$sourceHash );
  47.             // update string in template as well
  48.             $tranStrings[$sourceHash]['trans'$string;
  49.             // this has to be the source, otherwise the translated string will enter the db and be recognised as a used master
  50.             $storedStrings[$gBitLanguage->mStrings[$editLang][$sourceHash]['source'];
  51.         }
  52.     }
  53.     $tranStrings $gBitLanguage->getTranslationString$sourceHash$editLang );
  54.     $gBitSmarty->assign_by_ref('tranStrings'$tranStrings );
  55.     $gBitSmarty->assign'lang'$editLang );
  56.     $gBitSmarty->assign'translate'TRUE );
  57.     $gBitSmarty->assign'saveSuccess'tra"The following items have been saved successfully" ).":" );
  58.     $gBitSmarty->assign'storedStrings'$storedStrings );
  59. }
  60.  
  61. if!empty$_REQUEST['hash') ) {
  62.     $tranStrings $gBitLanguage->getTranslationString$_REQUEST['hash']$editLang );
  63.     $gBitSmarty->assign_by_ref('tranStrings'$tranStrings );
  64. elseif!empty$_REQUEST['choose_lang') ) {
  65.     $editLang $_REQUEST['choose_lang'];
  66.     $gBitSmarty->assign'editLang'$editLang );
  67.     // what strings do we want to display?
  68.     ifempty$_REQUEST['char') ) {
  69.         $pattern "/^a/i";
  70.     elseif $_REQUEST['char'== '0-9' {
  71.         $pattern "/^\d/";
  72.     elseif $_REQUEST['char'== '+' {
  73.         $pattern "/^[^a-zA-Z]/";
  74.     elseif $_REQUEST['char'== 'all' {
  75.         $pattern NULL;
  76.     else {
  77.         $pattern "/^".$_REQUEST['char']."/i";
  78.     }
  79.     $gBitLanguage->loadLanguage$editLang );
  80.     $tranStr $gBitLanguage->mStrings[$editLang];
  81.  
  82.     foreach$tranStr as $key => $tran {
  83.         // display only the wanted strings and apply a textbox if the string is too long
  84.         if!empty$_REQUEST['un_trans'&& empty$tran['trans'|| empty$_REQUEST['un_trans') ) {
  85.             ifempty$pattern || preg_match$pattern$tran['source') ) {
  86.                 $tranStrings[$key$tran;
  87.                 ifstrlen$tran['source'50 {
  88.                     $tranStrings[$key]['textarea'TRUE;
  89.                 }
  90.             }
  91.         }
  92.     }
  93.     $gBitSmarty->assign'char'empty$_REQUEST['char''' $_REQUEST['char');
  94.     $gBitSmarty->assign_by_ref'tranStrings'$tranStrings );
  95. }
  96.  
  97. $gBitSystem->display'bitpackage:languages/translate_strings.tpl'tra'Edit Translations' array'display_mode' => 'edit' ));

Documentation generated on Wed, 29 Jul 2015 13:57:30 +0000 by phpDocumentor 1.5.0-lsces