Commit 3dce5c152d25d6258b7a686d2350f30341c448ed

Authored by Adriano Vieira
1 parent fdc5e0e9
Exists in master and in 1 other branch 3.1

Atualização do "trunk"

- atualizada a biblioteca phpTranslator-0.2.0-111 (final)


git-svn-id: http://svn.softwarepublico.gov.br/svn/cacic/cacic/trunk/gerente@254 fecfc0c7-e812-0410-ae72-849f08638ee7
bibliotecas/phpTranslator/ToDo.txt
@@ -9,31 +9,34 @@ The package TODO/Roadmap: ;) @@ -9,31 +9,34 @@ The package TODO/Roadmap: ;)
9 9
10 version: 0.2.0 10 version: 0.2.0
11 11
12 - * finalizar recurso de seccionar o arquivo de idiomas  
13 - - falta apenas a traducao da "aba" quando nao for a ativa 12 +OK * finalizar recurso de seccionar o arquivo de idiomas
  13 +OK - falta apenas a traducao da "aba" quando nao for a ativa
14 OK * Traduzir mensagens ainda "fixas" 14 OK * Traduzir mensagens ainda "fixas"
15 OK * usar chamada por referencia para alguns objetos (ex: objtmpl) 15 OK * usar chamada por referencia para alguns objetos (ex: objtmpl)
16 OK * fazer todas as propriedades (atributos) "private" 16 OK * fazer todas as propriedades (atributos) "private"
17 OK - construir metodos para manipula-los 17 OK - construir metodos para manipula-los
18 OK * corrigir template de insercao/alteracao de codigos de idiomas 18 OK * corrigir template de insercao/alteracao de codigos de idiomas
19 OK - tamanhos dos campos conforme os proprios atributos definidos 19 OK - tamanhos dos campos conforme os proprios atributos definidos
20 - * formularios devem prever valor zero para o tamanho dos campos: idioma, contexto, tipo;  
21 - nos formularios: codificacao, listagem e traducao  
22 - - campos que nao podem ser zero (obvio): codigo_mensagem e texto_mensagem 20 +TBD * formularios devem prever valor zero para o tamanho dos campos: idioma, contexto, tipo;
  21 +TBD nos formularios: codificacao, listagem e traducao
  22 +TBD - campos que nao podem ser zero (obvio): codigo_mensagem e texto_mensagem
23 OK * path para o arquivo de idiomas deve ser informado na construtora 23 OK * path para o arquivo de idiomas deve ser informado na construtora
24 - * inicializar array de mensagens de texto "destino" na construtora 24 +NA * inicializar array de mensagens de texto "destino" na construtora
25 OK * possibilitar uso de textos em arquivo externo 25 OK * possibilitar uso de textos em arquivo externo
26 OK - tipo de mensagem deve ser: "arquivo" ou "file" 26 OK - tipo de mensagem deve ser: "arquivo" ou "file"
27 OK - texto da mensagem deve ser o nome do arquivo a ser usado (exemplo: introducao.html) 27 OK - texto da mensagem deve ser o nome do arquivo a ser usado (exemplo: introducao.html)
28 28
29 version: 0.2.1 29 version: 0.2.1
30 30
31 - * implementar recurso de insercao de idiomas de traducao 31 + * implementar recurso de criação de idiomas de traducao
32 - para a propria classe e/ou generico 32 - para a propria classe e/ou generico
33 * implementar recurso de selecao do idioma padrao e destino 33 * implementar recurso de selecao do idioma padrao e destino
34 34
35 version: ? 35 version: ?
36 36
  37 + * formularios devem prever valor zero para o tamanho dos campos: idioma, contexto, tipo;
  38 + nos formularios: codificacao, listagem e traducao
  39 + - campos que nao podem ser zero (obvio): codigo_mensagem e texto_mensagem
37 * usar editor de arquivos externo para mensagens do tipo "arquivo" ou "file" 40 * usar editor de arquivos externo para mensagens do tipo "arquivo" ou "file"
38 * build the phpTranslator as a Joomla! component to translate another components or Joomla! 41 * build the phpTranslator as a Joomla! component to translate another components or Joomla!
39 OK * deprecated (at v0.1.41) methods or attributes will be deleted 42 OK * deprecated (at v0.1.41) methods or attributes will be deleted
bibliotecas/phpTranslator/Translator.php
1 <?php 1 <?php
2 - /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */  
3 - 2 +
  3 +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  4 +
  5 +/**
  6 + * Arquivo que contem a classe de traducao e outros para a traducao de aplicacoes
  7 + *
  8 + * As aplicacoes baseadas nesse arquivo/classe deverao adaptar-se ao modo como este
  9 + * monta os arquivos de idiomas e seus requisitos de codificacao de idioma.
  10 + *
  11 + * PHP versions 4 and 5
  12 + *
  13 + * LICENSE: This source file is subject to version 3 of the GNU/GPL license
  14 + * that is available through the world-wide-web at the following URI:
  15 + * http://www.gnu.org/copyleft/gpl.html. If you did not receive a copy of
  16 + * the GNU/GPL License and are unable to obtain it through the web, please
  17 + * send a note to harpiain at users.sourceforge.net so I can mail you a copy immediately.
  18 + *
  19 + * Um exemplo de como usar a classe:
  20 + * <code>
  21 + *
  22 + * define(TRANSLATOR_PATH, "../include/phpTranslator/");
  23 + * define(TRANSLATOR_PATH_URL, "../include/phpTranslator/");
  24 + *
  25 + * if(!@include_once( TRANSLATOR_PATH.'/Translator.php'))
  26 + * echo "<h1>There is a trouble with phpTranslator package.
  27 + * It isn't found.</h1>";
  28 + *
  29 + * $_objTranslator = new Translator( USER_LOCALE );
  30 + *
  31 + * $_objTranslator->setLangFilePath( "/myapplic_path_lang_files/" );
  32 + * $_objTranslator->setURLPath( TRANSLATOR_PATH_URL );
  33 + * $_objTranslator->initStdLanguages();
  34 + * if(CODING)
  35 + * $_objTranslator->translatorGUI( false );
  36 + * elseif(TRANSLATING)
  37 + * $_objTranslator->translatorGUI();
  38 + * else
  39 + * echo $_objTranslator->getText( 'some text to translate and
  40 + * be showed after had been registred.' );
  41 + * </code>
  42 + *
  43 + * @category PHP-Tool
  44 + * @package phpTranslator
  45 + * @author Adriano dos Santos Vieira (harpiain) <harpiain@users.sourceforge.net>
  46 + * @copyright 2005-2007 Adriano dos Santos Vieira
  47 + * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL License 3.0
  48 + * @version subVersion: $Id: phpTranslator, v 0.2.0-40 feb/23/2006 $
  49 + * @link http://obiblioopac4j.sourceforge.net
  50 + * @see Translator()
  51 + * @since File available since Release 0.0.1
  52 + * @todo The package TODO/Roadmap are: {@example ToDo.txt}
  53 + */
  54 +
  55 +/**
  56 + * Constante que define o "ENTER" e o "SALTO DE LINHA" nos arquivos de idiomas
  57 + * @access private
  58 + */
  59 +define(T_CRLF, chr(13) . chr(10));
  60 +
  61 +/**
  62 + * Constante que define a cor do texto ainda nao traduzido
  63 + * @access private
  64 + */
  65 +define(T_BG_COLOR_TRADUZ, "#e7d4d4");
  66 +
  67 +/**
  68 + * Constrante que define se apenas traducao
  69 + * @access private
  70 + */
  71 +define(T_TRANSLATOR, true);
  72 +
  73 +/**
  74 + * Constante que define se codificacao e traducao
  75 + * @access private
  76 + */
  77 +define(T_CODER, false);
  78 +
  79 +/**
  80 + * Classe para realizar a traducao de um texto com base em arquivos pre-definidos
  81 + *
  82 + * As aplicacoes baseadas nessa classe deverao adaptar-se ao modo como esta classe <br>
  83 + * monta os arquivos de idiomas e seus requisitos de codificacao de idioma.
  84 + *
  85 + * @category PHP-Tool
  86 + * @package phpTranslator
  87 + * @author Adriano dos Santos Vieira (harpiain) <harpiain@users.sourceforge.net>
  88 + */
  89 +Class Translator {
  90 +
  91 + /**
  92 + * path para para a propria classe
  93 + * @access private
  94 + * @var string
  95 + */
  96 + var $classSelfPath = "./";
  97 +
  98 + /**
  99 + * path relativo (URL) para a classe
  100 + * @access private
  101 + * @var string
  102 + */
  103 + var $translatorUrlPath = "./";
  104 +
  105 + /**
  106 + * path para o arquivo de mensagens
  107 + * @access private
  108 + * @var sting
  109 + */
  110 + var $languageFilePath = "./";
  111 +
  112 + /**
  113 + * prefixo para o arquivo de mensagens
  114 + * @access private
  115 + * @var $languageFilePrefix
  116 + */
  117 + var $languageFilePrefix = "language.";
  118 +
  119 + /**
  120 + * sufixo para o arquivo de mensagens
  121 + * @access private
  122 + * @var string
  123 + */
  124 + var $languageFileSufix = ".inc.php";
  125 +
  126 + /**
  127 + * contera as mensagens a serem exibidas para a aplicacao de 2 idiomas (source and target)
  128 + *
  129 + * @access private
  130 + * @var array
  131 + */
  132 + var $translated_text = "";
  133 +
  134 + /**
  135 + * contera as mensagens padrao
  136 + *
  137 + * @access private
  138 + * @var array
  139 + */
  140 + var $translatedTextStd = array ();
  141 +
  142 + /**
  143 + * contera as mensagens traduzidas (ex: en-us)
  144 + *
  145 + * @access private
  146 + * @var array
  147 + */
  148 + var $translatedTextTgt = array ();
  149 +
  150 + /**
  151 + * contera as mensagens da propria classe traduzidas ou padrao
  152 + *
  153 + * @access private
  154 + * @var array
  155 + * @since v 0.2.0-40
  156 + */
  157 + var $translatedTextSelf = array ();
  158 +
  159 + /**
  160 + * padrao da aplicacao
  161 + *
  162 + * @access private
  163 + * @var string
  164 + */
  165 + var $languageStd = "pt-br";
  166 +
  167 + /**
  168 + * preferencia do usuario
  169 + * @access private
  170 + * @var string
  171 + */
  172 + var $languageUser = "";
  173 +
  174 + /**
  175 + * se traduz textos padrao conforme idioma:
  176 + * TRUE - tenta traduzir todos os textos;
  177 + * FALSE - nao traduz os textos
  178 + *
  179 + * @access private
  180 + * @var boolean
  181 + */
  182 + var $translateMessage = true;
  183 +
  184 + /**
  185 + * se os arquivos de idioma estarao em sub-diretorios, conforme abrevitura ISO I18N
  186 + * ex: pt-br/language.pt-br.inc.php, en/language.en.inc.php ...
  187 + * TRUE - os arquivos estarao em subdiretorios;
  188 + * FALSE - os arquivos nao estarao em subdiretorios
  189 + *
  190 + * @access private
  191 + * @var boolean
  192 + * @since v 0.2.0-40
  193 + */
  194 + var $languageFilesubdir = false;
  195 +
  196 + /**
  197 + * se os arquivos de idioma estarao seccionados, conforme contextualizacao
  198 + * ex: prefix.SECTION.sufix == language.admin.pt-br.inc.php ...
  199 + * TRUE - os arquivos estarao seccionados;
  200 + * FALSE - os arquivos nao estarao seccionados
  201 + *
  202 + * @access private
  203 + * @var boolean
  204 + * @since v 0.2.0-40
  205 + */
  206 + var $languageFileInSections = false;
  207 +
  208 + /**
  209 + * devera conter as secoes dos arquivos de idiomas, conforme contextualizacao
  210 + *
  211 + * <code>
  212 + * ...
  213 + * $_lang_sections = array('phpTranslator' => 'textos da classe de traducao',
  214 + * 'admin' => 'Textos da secao administrativa',
  215 + * 'home' => 'textos da secao principal',
  216 + * 'and son on' => 'e assim por diante...');
  217 + * ...
  218 + * </code>
  219 + * @access private
  220 + * @var array
  221 + * @since v 0.2.0-40
  222 + */
  223 + var $languageSections = array ();
  224 +
  225 + /**
  226 + * devera conter a secao ativa a ser mostrada/traduzida, quando fizer uso de secoes
  227 + *
  228 + * @access private
  229 + * @var array
  230 + * @since v 0.2.0-40
  231 + */
  232 + var $languageSectionActive = "";
  233 +
  234 + /**
  235 + * possiveis mensagens retornadas pela classe
  236 + * @access private
  237 + * @var string
  238 + */
  239 + var $mensagem = "";
  240 +
  241 + /**
  242 + * se ocorreu erro em um metodo - true = ocorreu erro; false = nao ocorreu erro
  243 + * @access private
  244 + * @var boolean
  245 + */
  246 + var $error = false;
  247 +
  248 + /**
  249 + * Tamanho para o codigo do idioma
  250 + * @var numeric
  251 + * @access private
  252 + */
  253 + var $messageCountryLen = 10;
  254 +
  255 + /**
  256 + * Tamanho para o codigo da mensagem
  257 + * @var numeric
  258 + * @access private
  259 + */
  260 + var $messageCodeLen = 100;
  261 +
  262 + /**
  263 + * Tamanho para o tipo da mensagem
  264 + * @var numeric
  265 + * @access private
  266 + */
  267 + var $messageTypeLen = 10;
  268 +
  269 + /**
  270 + * Tamanho para a abreviacao
  271 + * @var numeric
  272 + * @access private
  273 + */
  274 + var $messageAbbrLen = 10;
  275 +
  276 + /**
  277 + * Tamanho para o contextualizacao (ex: admin, config, preferences, front-end etc)
  278 + * @var numeric
  279 + * @access private
  280 + */
  281 + var $messageContextLen = 10;
  282 +
  283 + /**
  284 + * contera as mensagens a serem exibidas para traducao
  285 + *
  286 + * @access private
  287 + * @var array
  288 + */
  289 + var $arrLanguageLang = array ();
  290 +
  291 + /**
  292 + * contera as mensagens a serem listadas
  293 + *
  294 + * @access private
  295 + * @var array
  296 + */
  297 + var $arrLanguageList = array ();
  298 +
  299 + /**
  300 + * idioma do browser
  301 + * @var string
  302 + * @access private
  303 + */
  304 + var $_browserLanguage = '';
  305 +
  306 + /**
  307 + * Se mostra todas as mensagens geradas pela aplicacao
  308 + * @var boolean
  309 + * @access private
  310 + */
  311 + var $_debugTranslator = false;
  312 +
  313 + /**
  314 + * Objeto template
  315 + * @var object
  316 + * @access private
  317 + */
  318 + var $_objTmpl;
  319 +
  320 + /**
  321 + * Metodo contrutor para realizar a traducao de um texto com base em arquivos pre-definidos
  322 + * @access public
  323 + * @name Translator
  324 + * @param string $_abbr_i18n_tgt - Deve ser informado o idioma destino para a aplicacao
  325 + * @param string $_langFilePath - path para o arquivo de mensagens
  326 + * @param string $_abbr_i18n_src - Deve ser informado o idioma padrao da aplicacao
  327 + * (padrao "en" = English)
  328 + */
  329 + function Translator($_abbr_i18n_tgt = '', $_langFilePath = '', $_abbr_i18n_src = 'en-us') {
  330 +
  331 + $_browserLanguage = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
  332 + if (strpos($_browserLanguage, ",")) {
  333 + $_browserLanguage = substr($_browserLanguage, 0, strpos($_browserLanguage, ","));
  334 + }
  335 + $this->_browserLanguage = $_browserLanguage;
  336 +
  337 + $this->classSelfPath = dirname(__FILE__);
  338 +
  339 + if (!empty ($_abbr_i18n_src))
  340 + $this->SetLanguage($_abbr_i18n_src);
  341 +
  342 + if (!empty ($_abbr_i18n_tgt))
  343 + $this->SetLanguage($_abbr_i18n_tgt, 'target');
  344 +
  345 + /*
  346 + * busca a propia traducao
  347 + */
  348 + $this->setLangFilePath($this->classSelfPath . "/languages/");
  349 + $this->translatedTextSelf = $this->_getLangFile($_abbr_i18n_tgt);
  350 + if ($this->error) {
  351 + $this->translatedTextSelf = $this->_getLangFile($_abbr_i18n_src);
  352 + if ($this->error) {
  353 + $this->translatedTextSelf = $this->_getLangFile("en-us");
  354 + }
  355 + }
  356 +
  357 + if (!empty ($_langFilePath))
  358 + $this->setLangFilePath($_langFilePath);
  359 +
  360 + } // end func: Translator
  361 +
  362 + /**
  363 + * Prove a interface de cadastramento de codigos de mensagems ou a de traducao
  364 + *
  365 + * @access public
  366 + * @param boolean $_translate_only FALSE - Se apenas para traduzir
  367 + * TRUE - tambem para fazer manutencao (default)
  368 + */
  369 + function translatorGUI($_translate_only = true) {
  370 +
  371 + // objeto para o template
  372 + $_objTmpl = & $this->_createTemplate();
  373 + $_objTmpl->setRoot($this->classSelfPath . '/templates');
  374 +
  375 + // Dados de inicializacao
  376 + if (!isset ($_POST['mnt_lang_action']))
  377 + $_langAction = 'listar';
  378 + elseif (array_key_exists('tradutor', $_POST['mnt_lang_action'])) $_langAction = 'tradutor';
  379 + elseif (array_key_exists('inserir', $_POST['mnt_lang_action'])) $_langAction = 'inserir';
  380 + elseif (array_key_exists('alterar', $_POST['mnt_lang_action'])) $_langAction = 'alterar';
  381 + elseif (array_key_exists('excluir', $_POST['mnt_lang_action'])) $_langAction = 'excluir';
  382 + elseif (array_key_exists('listar', $_POST['mnt_lang_action'])) $_langAction = 'listar';
  383 + elseif (array_key_exists('salvar', $_POST['mnt_lang_action'])) $_langAction = 'salvar';
  384 + elseif (array_key_exists('create_lang', $_POST['mnt_lang_action'])) $this->_createLanguageDef($_objTmpl);
  385 +
  386 + if (!empty ($_POST['tag_active']))
  387 + $this->languageSectionActive = $_POST['tag_active'];
  388 +
  389 + $this->initStdLanguages();
  390 +
  391 + $_list_lang = false;
  392 + $_abbr_i18n_save = $this->languageStd;
  393 + $_mnt_language = $_POST['mnt_language'];
  394 + $_lang_code_selected = $_POST['mnt_code_selected'];
  395 + $_lang_data_selected[$_lang_code_selected] = ($_POST['mnt_lang_data'][$_lang_code_selected]);
  396 +
  397 + // Variaveis para o Template
  398 +
  399 + // fim de variaveis para o template
  400 +
  401 + // inicio de Montagem pagina HTML
  402 + $_objTmpl->readTemplatesFromInput('translate_mnt_tmpl.html');
  403 + $_objTmpl->addVar('ini_page_form', 'classSelfPath', $this->classSelfPath);
  404 + $_objTmpl->addVar('ini_page_form', 'TRANSLATOR_URL_PATH', $this->translatorUrlPath);
  405 + $_objTmpl->addVar('tmplTagHeader', 'TRANSLATOR_URL_PATH', $this->translatorUrlPath);
  406 +
  407 + // Se acionado o botao para traduzir, retira-o e mostra o SALVAR/RESTAURAR
  408 + if ($_translate_only) {
  409 + $_objTmpl->addVar('ini_page_form_btn', 'mnt_btn_show', "translate");
  410 + }
  411 + if (isset ($_POST['save_translation'])) {
  412 + $this->_langSave($_POST['lang_target'], $this->languageUser);
  413 + }
  414 +
  415 + if (defined('_VALID_MOS'))
  416 + $_objTmpl->addVar('ini_page_form_mos', 'mos_page', "inside");
  417 +
  418 + if ($_langAction == 'excluir') {
  419 + $this->_langCodeDelete($_lang_data_selected);
  420 + $_list_lang = true;
  421 + $this->_langSave($this->translatedTextStd, $_abbr_i18n_save);
  422 + }
  423 +
  424 + if ($_langAction == 'salvar') {
  425 + $_list_lang = true;
  426 + $this->translatedTextStd[$this->stripContraBarra($_mnt_language['code'])] = $_mnt_language;
  427 + $this->_langSave($this->translatedTextStd, $_abbr_i18n_save);
  428 + }
  429 +
  430 + // (re)constroi os arrays para o template
  431 + if (!empty ($_POST['tag_active']))
  432 + $this->languageSectionActive = $_POST['tag_active'];
  433 +
  434 + $this->initStdLanguages();
  435 + $this->buildArrayVars();
  436 +
  437 + $titulo = $this->getText('#phpTranslator_page_title#');
  438 + $_objTmpl->addVar('ini_page_form', 'titulo', $titulo);
  439 + $_objTmpl->addVar('ini_page_form', 'PHPTRANSLATOR_EXCLUIR_CODIGO', $this->getText('#phpTranslator_excluir codigo#'));
  440 + $_objTmpl->displayParsedTemplate('ini_page_form');
  441 + $this->showTagHeader(& $_objTmpl);
  442 +
  443 + $_objTmpl->addVar('ini_page_form_btn', 'BTN_INSERIR', $this->getText('#phptranslator_inserir#'));
  444 + $_objTmpl->addVar('ini_page_form_btn', 'BTN_CREATE_LANG', $this->getText('#phptranslator_criar idioma#'));
  445 + $_objTmpl->addVar('ini_page_form_btn', 'BTN_ALTERAR', $this->getText('#phptranslator_alterar#'));
  446 + $_objTmpl->addVar('ini_page_form_btn', 'BTN_EXCLUIR', $this->getText('#phptranslator_excluir#'));
  447 + $_objTmpl->addVar('ini_page_form_btn', 'BTN_LISTAR', $this->getText('#phptranslator_listar#'));
  448 + $_objTmpl->addVar('ini_page_form_btn', 'BTN_TRADUZIR', $this->getText('#phptranslator_traduzir#'));
  449 + $_objTmpl->addVar('ini_page_form_btn', 'BTN_SALVAR', $this->getText('#phptranslator_salvar#'));
  450 + $_objTmpl->addVar('ini_page_form_btn', 'BTN_RESTAURAR', $this->getText('#phptranslator_restaurar#'));
  451 +
  452 + $_objTmpl->addVar('ini_page_form_btn', 'MSG_SELECT_ONE_CHANGE', $this->getText('#phptranslator_falta selecionar mensagem a ser alterada#'));
  453 +
  454 + $_objTmpl->addVar('ini_page_form_btn', 'MSG_SELECT_ONE_DELETE', $this->getText('#phptranslator_falta selecionar mensagem a ser excluida#'));
  455 +
  456 + $_objTmpl->addVar('translate_mnt', 'BTN_SALVAR', $this->getText('#phptranslator_salvar#'));
  457 + $_objTmpl->addVar('translate_mnt', 'BTN_RESTAURAR', $this->getText('#phptranslator_restaurar#'));
  458 + $_objTmpl->addVar('translate_mnt', 'STANDARD_LANG_CODING', $this->getText('#phptranslator_codificacao de idioma padrao#'));
  459 + $_objTmpl->addVar('translate_mnt', 'STANDARD_LANG_CODING_CONTEXT', $this->getText('#phptranslator_contexto da mensagem#'));
  460 + $_objTmpl->addVar('translate_mnt', 'STANDARD_LANG_CODING_LANG', $this->getText('#phptranslator_idioma#'));
  461 + $_objTmpl->addVar('translate_mnt', 'STANDARD_LANG_CODING_MSG_CODE', $this->getText('#phptranslator_codigo da mensagem#'));
  462 + $_objTmpl->addVar('translate_mnt', 'STANDARD_LANG_CODING_MSG_TYPE', $this->getText('#phptranslator_tipo da mensagem#'));
  463 + $_objTmpl->addVar('translate_mnt', 'STANDARD_LANG_CODING_MSG_ABBR', $this->getText('#phptranslator_sigla para a mensagem#'));
  464 + $_objTmpl->addVar('translate_mnt', 'STANDARD_LANG_CODING_MSG', $this->getText('#phptranslator_mensagem#'));
  465 + $_objTmpl->addVar('translate_mnt', 'STANDARD_LANG_CODING_ADVISE', $this->getText('#phptranslator_mnt_code_advise#'));
  466 +
  467 + $_objTmpl->addVar('translate_list_head', 'STANDARD_LANG_REPORTING', $this->getText('#phptranslator_listagem de mensagens padrao codificadas#'));
  468 +
  469 + $_objTmpl->displayParsedTemplate('form_buttons');
  470 +
  471 + if (($_langAction !== 'tradutor' and $_langAction !== 'excluir' and $_langAction !== 'listar' and !$_translate_only)) {
  472 +
  473 + $_show_form = true;
  474 +
  475 + $_objTmpl->addVar('translate_mnt', "LANG_COUNTRY_LEN", $this->messageCountryLen);
  476 + $_objTmpl->addVar('translate_mnt', "LANG_CODE_LEN", $this->messageCodeLen);
  477 + $_objTmpl->addVar('translate_mnt', "LANG_CONTEXT_LEN", $this->messageContextLen);
  478 + $_objTmpl->addVar('translate_mnt', "LANG_TYPE_LEN", $this->messageTypeLen);
  479 + $_objTmpl->addVar('translate_mnt', "LANG_ABBR_LEN", $this->messageAbbrLen);
  480 +
  481 + if (isset($_POST['mnt_lang_action']) and array_key_exists('alterar', $_POST['mnt_lang_action'])) {
  482 + if (empty ($_lang_code_selected))
  483 + $_show_form = false;
  484 +
  485 + $_objTmpl->addVar('translate_mnt', "LANG_COUNTRY", $this->stripContraBarra($_lang_data_selected[$_lang_code_selected]['lang']));
  486 + $_objTmpl->addVar('translate_mnt', "LANG_CODE_DISABLED", 'disabled');
  487 + $_objTmpl->addVar('translate_mnt', "LANG_CODE", $this->stripContraBarra($_lang_code_selected));
  488 + $_objTmpl->addVar('translate_mnt', "LANG_CONTEXT", $this->stripContraBarra($_lang_data_selected[$_lang_code_selected]['context']));
  489 + $_objTmpl->addVar('translate_mnt', "LANG_TYPE", $this->stripContraBarra($_lang_data_selected[$_lang_code_selected]['type']));
  490 + $_objTmpl->addVar('translate_mnt', "LANG_ABBR", $this->stripContraBarra($_lang_data_selected[$_lang_code_selected]['abbr']));
  491 + $_objTmpl->addVar('translate_mnt', "LANG_MESSAGE", $this->stripContraBarra($_lang_data_selected[$_lang_code_selected]['text']));
  492 + } else {
  493 + $_objTmpl->addVar('translate_mnt', "LANG_COUNTRY", $this->languageStd);
  494 + }
  495 +
  496 + if ($_show_form)
  497 + $_objTmpl->displayParsedTemplate('translate_mnt');
  498 + $_list_lang = true;
  499 + }
  500 +
  501 + if (!$_translate_only and ($_langAction == 'listar' or $_list_lang)) {
  502 + $_objTmpl->displayParsedTemplate('translate_list_head');
  503 + if ($this->arrLanguageList)
  504 + foreach ($this->arrLanguageList as $_keys => $_key) {
  505 + $_objTmpl->addVar('translate_list_body', 'TAB_CONTEXT', $_keys);
  506 +
  507 + $_objTmpl->addVar('translate_list_body', 'STANDARD_LANG_CODING_LANG', $this->getText('#phptranslator_idioma#'));
  508 + $_objTmpl->addVar('translate_list_body', 'STANDARD_LANG_CODING_MSG_CODE', $this->getText('#phptranslator_codigo da mensagem#'));
  509 + $_objTmpl->addVar('translate_list_body', 'STANDARD_LANG_CODING_MSG_TYPE', $this->getText('#phptranslator_tipo da mensagem#'));
  510 + $_objTmpl->addVar('translate_list_body', 'STANDARD_LANG_CODING_MSG_ABBR', $this->getText('#phptranslator_sigla para a mensagem#'));
  511 + $_objTmpl->addVar('translate_list_body', 'STANDARD_LANG_CODING_MSG', $this->getText('#phptranslator_mensagem#'));
  512 +
  513 + $_objTmpl->addRows('translate_list_by_context', $this->arrLanguageList[$_keys]);
  514 + $_objTmpl->displayParsedTemplate('translate_list_body');
  515 + // limpa dados de template para acrecentar outros dados
  516 + $_objTmpl->clearTemplate('translate_list_body');
  517 + $_objTmpl->clearTemplate('translate_list_by_context');
  518 + } // end foreach
  519 + else
  520 + $_objTmpl->addVar('translate_list_foot', 'LIST_MESSAGE', $this->getText('#phptranslator_text#') . " " . $this->getText('#phptranslator_not found#'));
  521 +
  522 + $_objTmpl->displayParsedTemplate('translate_list_foot');
  523 + }
  524 +
  525 + if ($_translate_only or $_langAction == 'tradutor') {
  526 + // inicio de Montagem pagina do tradutor
  527 + $_objTmpl->readTemplatesFromInput('translate_tmpl.html');
  528 + $_objTmpl->addVar('translate_lang_head', 'STANDARD_LANG_TRANSLATION', $this->getText('#phptranslator_traducao do idioma padrao#'));
  529 +
  530 + $_objTmpl->displayParsedTemplate('translate_lang_head');
  531 + if (is_array($this->arrLanguageLang))
  532 + foreach ($this->arrLanguageLang as $_keys => $_key) {
  533 + $_objTmpl->addVar('translate_lang_body', 'STANDARD_TEXT', $this->getText('#phptranslator_texto padrao#'));
  534 + $_objTmpl->addVar('translate_lang_body', 'TARGET_TEXT', $this->getText('#phptranslator_traduzir para#'));
  535 + $_objTmpl->addVar('translate_lang_body', 'TRANSLATED_TEXT', $this->getText('#phptranslator_texto traduzido#'));
  536 + $_objTmpl->addVar('translate_lang_body', 'ABBREVIATION', $this->getText('#phptranslator_sigla#') .
  537 + "/" .
  538 + $this->getText('#phptranslator_simbolo#'));
  539 + $_objTmpl->addVar('translate_lang_body', 'BTN_SALVAR', $this->getText('#phptranslator_salvar#'));
  540 + $_objTmpl->addVar('translate_lang_body', 'BTN_RESTAURAR', $this->getText('#phptranslator_restaurar#'));
  541 +
  542 + $_objTmpl->addVar('translate_lang_body', 'TAB_CONTEXT', $_keys);
  543 + $_objTmpl->addVar('translate_lang_body', 'LANGUAGE_SOURCE', "(" . $this->languageStd . ")");
  544 + $_objTmpl->addVar('translate_lang_body', 'LANGUAGE_TARGET', "(" . $this->_getLanguage() . ")");
  545 + $_objTmpl->addRows('translate_lang_list_entry', $this->arrLanguageLang[$_keys]);
  546 + $_objTmpl->displayParsedTemplate('translate_lang_body');
  547 + // limpa dados de template para acrecentar outros dados
  548 + $_objTmpl->clearTemplate('translate_lang_body');
  549 + $_objTmpl->clearTemplate('translate_lang_list_entry');
  550 + } // end foreach
  551 +
  552 + $_objTmpl->displayParsedTemplate('translate_lang_foot');
  553 + // fim de Montagem pagina do tradutor
  554 + }
  555 + $_objTmpl->displayParsedTemplate('end_page_form');
  556 +
  557 + } //end func: Translate
  558 +
4 /** 559 /**
5 - * Arquivo que contem a classe de traducao e outros para a traducao de aplicacoes 560 + * Busca o texto a ser traduzido
  561 + *
  562 + * @access public
  563 + * @see getText()
  564 + * @return string O texto traduzido, o texto padrao ou o codigo da mensagem
6 * 565 *
7 - * As aplicacoes baseadas nesse arquivo/classe deverao adaptar-se ao modo como este  
8 - * monta os arquivos de idiomas e seus requisitos de codificacao de idioma. 566 + */
  567 + function _($_msg_code, $_sigla = false, $_text_case = 0, $_args = array ()) {
  568 + return $this->getText($_msg_code, $_sigla, $_text_case, $_args);
  569 + }
  570 +
  571 + /**
  572 + * Busca o texto a ser traduzido
9 * 573 *
10 - * PHP versions 4 and 5 574 + * Busca a traducao do texto - caso o texto traduzido nao exista retorna o texto padrao e caso este
  575 + * tambem nao exista retorna o codigo de pesquisa
11 * 576 *
12 - * LICENSE: This source file is subject to version 3 of the GNU/GPL license  
13 - * that is available through the world-wide-web at the following URI:  
14 - * http://www.gnu.org/copyleft/gpl.html. If you did not receive a copy of  
15 - * the GNU/GPL License and are unable to obtain it through the web, please  
16 - * send a note to harpiain at users.sourceforge.net so I can mail you a copy immediately. 577 + * @access public
  578 + * @param string $_msg_code O codigo da mensagem a ser traduzida
  579 + * @param boolean $_sigla Se retorna a sigla em lugar da mensagem completa
  580 + * @param boolean $_text_case Se o texto retorna o texto como cadastrado, em maiusculas ou minusculas
  581 + * 1 - maiuscula
  582 + * 2 - minuscula
  583 + * outro - como estiver cadastrado
  584 + * @param array $_args Sao os argumentos que serão inseridos na mensagem nas posições onde houver %N
  585 + * (onde N é a quantidade sequencial de parâmetros)
17 * 586 *
18 - * Um exemplo de como usar a classe: 587 + * @return string O texto traduzido, o texto padrao ou o codigo da mensagem
  588 + *
  589 + */
  590 + function getText($_msg_code, $_sigla = false, $_text_case = 0, $_args = array ()) {
  591 +
  592 + if (is_array($_sigla)) {
  593 + $_args = $_sigla;
  594 + $_sigla = false;
  595 + }
  596 + if (is_array($_text_case)) {
  597 + $_args = $_text_case;
  598 + $_text_case = 0;
  599 + }
  600 + if (!is_bool($_sigla))
  601 + $_sigla = false;
  602 +
  603 + if (!empty ($_msg_code) && ($this->translateMessage)) {
  604 + $_msg_text = $this->_getStdText(& $_msg_code, & $_sigla, & $_text_case, & $_args);
  605 + } else {
  606 + $_msg_text = $_msg_code;
  607 + }
  608 +
  609 + return $_msg_text;
  610 +
  611 + } // end func: getText
  612 +
  613 + /**
  614 + * Metodo para retornar a mensagens de erros ocorridas
  615 + *
  616 + * @access public
  617 + * @name getMessage
  618 + */
  619 + function getMessage() {
  620 + return $this->mensagem;
  621 + } // end func: getMessage
  622 +
  623 + /**
  624 + * Metodo para retornar se houve erro ou nao na classe
  625 + *
  626 + * @access public
  627 + * @return boolean TRUE - houve erro ao processar a classe
  628 + * FALSE - nao houve erro
  629 + */
  630 + function isError() {
  631 + return $this->error;
  632 + } // end func: isError
  633 +
  634 + /**
  635 + * Atribui o caminho fisico para os arquivos de idiomas
  636 + *
  637 + * devera conter as secoes dos arquivos de idiomas, conforme contextualizacao
19 * <code> 638 * <code>
  639 + * ...
  640 + * $_lang_sections = array(
  641 + * 'phpTranslator' => 'textos da classe de traducao',
  642 + * 'admin' => 'Textos da secao administrativa',
  643 + * 'home' => 'textos da secao principal',
  644 + * 'and son on' => 'e assim por diante...');
20 * 645 *
21 - * define(TRANSLATOR_PATH, "../include/phpTranslator/");  
22 - * define(TRANSLATOR_PATH_URL, "../include/phpTranslator/"); 646 + * $objTranslator->setLangFileSections($_lang_sections);
  647 + * ...
  648 + * </code>
  649 + * @param string $_languageFilePath O caminho para os arquivos de idiomas
  650 + * @var array
  651 + * @since v 0.2.0-40
  652 + */
  653 + function setLangFileSections($_languageSections = array ()) {
  654 + if (empty ($_languageSections)) {
  655 + $this->message = "Impossivel processar traducao por secoes, secoes nao informadas.";
  656 + $this->error = true;
  657 + } else {
  658 + $this->languageSections = $_languageSections;
  659 + $this->error = false;
  660 + }
  661 + return !$this->error;
  662 + }
  663 +
  664 + /**
  665 + * Atribui o caminho fisico para os arquivos de idiomas
  666 + *
  667 + * @param string $_languageFilePath O caminho para os arquivos de idiomas
  668 + */
  669 + function setLangFilePath($_languageFilePath = "") {
  670 + if (!empty ($_languageFilePath))
  671 + $this->languageFilePath = $_languageFilePath;
  672 + } // end func: setLangFilePath
  673 +
  674 + /**
  675 + * Mostra o formulario de selecao de contextos
  676 + * @access private
  677 + * @since v 0.2.0-40
  678 + */
  679 + function showTagHeader(& $_objTmpl) {
  680 + if ($this->languageFileInSections)
  681 + if (!is_object($_objTmpl)) {
  682 + $this->mensagem = $this->getText('#phptranslator_objTemplate#') . $this->getText('#phptranslator_not found#');
  683 + if ($this->inDebugMode())
  684 + echo "phpTranslator: " . $this->getMessage();
  685 + $this->error = true;
  686 + } else {
  687 + if (is_array($this->languageSections) and !empty ($this->languageSections)) {
  688 + $_list = array ();
  689 + foreach ($this->languageSections as $_tag => $_tag_title) {
  690 + $_tag_current = '';
  691 + if ($_tag == $this->languageSectionActive)
  692 + $_tag_current = 'TagCurrent';
  693 +
  694 + $_arrAux = array (
  695 + array (
  696 + 'TAG_NAME' => $_tag,
  697 + 'TAG_HEADER_ACTIVE' => $_tag_current,
  698 + 'TAG_HEADER' => $this->getText($_tag),
  699 + 'TAG_HEADER_TITLE' => $this->getText($_tag_title)
  700 + )
  701 + );
  702 + $_list = array_merge($_list, $_arrAux);
  703 + }
  704 + /*
  705 + echo $this->languageSectionActive;
  706 + if('tradutor' == $this->languageSectionActive)
  707 + $_tag_current = 'TagCurrent';
  708 +
  709 + $_list = array_merge($_list,
  710 + array(
  711 + array(
  712 + 'TAG_NAME' => 'tradutor',
  713 + 'TAG_HEADER_ACTIVE' => $_tag_current,
  714 + 'TAG_HEADER' => $this->getText('tradutor'),
  715 + 'TAG_HEADER_TITLE' => $this->getText('Classe Tradutora')
  716 + )
  717 + )
  718 + );
  719 + */
  720 + $_objTmpl->addRows('tmplTagHeader_list', $_list);
  721 + $_objTmpl->addVar('tmplTagHeader', 'translatorUrlPath', $this->translatorUrlPath);
  722 + $_objTmpl->addVar('tmplTagHeader', 'TAG_ACTIVE', $_POST['tag_active']);
  723 + $_objTmpl->displayParsedTemplate('tmplTagHeader');
  724 + } else {
  725 + $this->mensagem = $this->getText('#phptranslator_section array not defined#');
  726 + if ($this->inDebugMode())
  727 + echo "phpTranslator: " . $this->getMessage();
  728 + $this->error = true;
  729 + }
  730 + }
  731 + } // end func: showTagHeader
  732 +
  733 + /**
  734 + * Atribui o caminho (URL) para a classe
  735 + *
  736 + * @param string $_translatorUrlPath A URL para a classe
  737 + * @since v 0.2.0-40
  738 + */
  739 + function setURLPath($_translatorUrlPath = "") {
  740 + if (!empty ($_translatorUrlPath))
  741 + $this->translatorUrlPath = $_translatorUrlPath;
  742 + } // end func: setURLPath
  743 +
  744 + /**
  745 + * Atribui o sufixo para o arquivo de idiomas
23 * 746 *
24 - * if(!@include_once( TRANSLATOR_PATH.'/Translator.php'))  
25 - * echo "<h1>There is a trouble with phpTranslator package.  
26 - * It isn't found.</h1>"; 747 + * @param string $_file_sufix O sufixo a ser atribuido ao arquivo
  748 + */
  749 + function setLangFileSufix($_file_sufix = "") {
  750 + if (!empty ($_file_sufix))
  751 + $this->languageFileSufix = $_file_sufix;
  752 + } // end func: setLangFileSufix
  753 +
  754 + /**
  755 + * Atribui o prefixo para o arquivo de idiomas
  756 + *
  757 + * @param string $_file_prefix O prefixo a ser atribuido ao arquivo
  758 + */
  759 + function setLangFilePrefix($_file_prefix = "") {
  760 + if (!empty ($_file_prefix))
  761 + $this->languageFilePrefix = $_file_prefix;
  762 + } // end func: setLangFilePrefix
  763 +
  764 + /**
  765 + * Atribui os idiomas a serem usado na aplicacao
27 * 766 *
28 - * $_objTranslator = new Translator( USER_LOCALE ); 767 + * @access private
  768 + * @param string $_abbr_i18n ISO do Idioma em questao
  769 + * @param string $_lang_choice Qual o padrao a ser lido e armazenado
  770 + * standard - o padrao para a aplicacao
  771 + * target - o idioma destino
  772 + * user - o idioma para o usuario
  773 + */
  774 + function setLanguage($_abbr_i18n, $_lang_choice = 'standard') {
  775 + switch ($_lang_choice) {
  776 + case 'standard' :
  777 + {
  778 + $this->setLangSrc($_abbr_i18n);
  779 + break;
  780 + }
  781 + case 'target' :
  782 + {
  783 + $this->setLangTgt($_abbr_i18n);
  784 + break;
  785 + }
  786 + case 'user' :
  787 + {
  788 + $this->setLangUser($_abbr_i18n);
  789 + break;
  790 + }
  791 + }
  792 + } // end func: setLanguage
  793 +
  794 + /**
  795 + * Inicializa os arrays de idiomas especificos (padrao ou destino)
  796 + * @access public
  797 + */
  798 + function initStdLanguages() {
  799 + $this->buildLangArray();
  800 + $this->buildLangArray('target');
  801 + }
  802 +
  803 + /**
  804 + * Le os arquivos de idioma e os armazena em array especificos (padrao ou destino)
  805 + * @access private
  806 + * @param string $_lang_choice Qual o padrao a ser lido e armazenado<br>
  807 + * . standard - o padrao para a aplicacao<br>
  808 + * . target - o idioma a ser mostrado para o usuario<br>
  809 + */
  810 + function buildLangArray($_lang_choice = 'standard') {
  811 + switch ($_lang_choice) {
  812 + case 'standard' :
  813 + {
  814 + $this->translatedTextStd = $this->_getLangFile();
  815 + $this->translated_text[$this->languageStd] = $this->translatedTextStd;
  816 + break;
  817 + }
  818 + case 'target' :
  819 + {
  820 + $this->translatedTextTgt = $this->_getLangFile($this->languageUser);
  821 + $this->translated_text[$this->languageUser] = $this->translatedTextTgt;
  822 + break;
  823 + }
  824 + }
  825 + } // end func: buildLangArray
  826 +
  827 + /**
  828 + * Constroi o array de traducao de idiomas (DE -> PARA)
29 * 829 *
30 - * $_objTranslator->setLangFilePath( "/myapplic_path_lang_files/" );  
31 - * $_objTranslator->setURLPath( TRANSLATOR_PATH_URL );  
32 - * $_objTranslator->initStdLanguages();  
33 - * if(CODING)  
34 - * $_objTranslator->translatorGUI( false );  
35 - * elseif(TRANSLATING)  
36 - * $_objTranslator->translatorGUI();  
37 - * else  
38 - * echo $_objTranslator->getText( 'some text to translate and  
39 - * be showed after had been registred.' );  
40 - * </code> 830 + * @access private
  831 + */
  832 + function getLangArray4Translate() {
  833 +
  834 + $_language_src = $this->translatedTextStd;
  835 + $_language_tgt = $this->translatedTextTgt;
  836 +
  837 + if ($_language_src) {
  838 + //Idioma a traduzir
  839 + // cria array para cada context
  840 + foreach ($_language_src as $_keys => $_key) {
  841 + if ($_key['type'] != 'notran')
  842 + $_list[$this->getText($_key['context'])] = array ();
  843 + } // end foreach
  844 +
  845 + foreach ($_language_src as $_keys => $_key) {
  846 + if (!empty ($_language_tgt[$_keys]['text']) or !empty ($_language_tgt[$_keys]['abbr']))
  847 + $_cor = "";
  848 + else
  849 + $_cor = T_BG_COLOR_TRADUZ;
  850 +
  851 + if ($_key['type'] != 'notran')
  852 + $_arrAux = array (
  853 + array (
  854 + 'cor' => $_cor,
  855 + 'lang_src_key' => $_keys,
  856 + 'lang_language' => $this->languageUser,
  857 + 'lang_context' => $_key['context'],
  858 + 'lang_type' => $_key['type'],
  859 + 'lang_src' => $_key['text'],
  860 + 'lang_tgt' => $_language_tgt[$_keys]['text'],
  861 + 'lang_tgt_acr' => $_language_tgt[$_keys]['abbr']
  862 + )
  863 + );
  864 +
  865 + //$_list = array_merge($_list, $_arrAux);
  866 + $_list[$this->getText($_key['context'])] = array_merge($_list[$this->getText($_key['context'])], $_arrAux);
  867 + } // end foreach
  868 + }
  869 +
  870 + if (empty ($_list))
  871 + $_list = false;
  872 +
  873 + return $_list;
  874 + } // end Function getLangArray4Translate
  875 +
  876 + /**
  877 + * Constroi o array de listagem de idioma padrao
  878 + *
  879 + * @access private
  880 + */
  881 + function getLangArray4List() {
  882 + $_language_src = $this->translatedTextStd;
  883 + //Idioma a traduzir
  884 + if (!empty ($_language_src)) {
  885 + // cria array para cada context
  886 + foreach ($_language_src as $_keys => $_key) {
  887 + if ($_key['type'] != 'notran')
  888 + $_list[$this->getText($_key['context'])] = array ();
  889 + } // end foreach
  890 +
  891 + foreach ($_language_src as $_keys => $_key) {
  892 + if ($_key['type'] != 'notran') {
  893 + $_arrAux = array (
  894 + array (
  895 + 'list_lang' => $this->languageStd,
  896 + 'list_lang_code' => $_keys,
  897 + 'list_lang_context' => $_key['context'],
  898 + 'list_lang_type' => $_key['type'],
  899 + 'list_lang_message' => $_key['text'],
  900 + 'list_lang_abbr' => $_language_src[$_keys]['abbr']
  901 + )
  902 + );
  903 +
  904 + $_list[$this->getText($_key['context'])] = array_merge($_list[$this->getText($_key['context'])], $_arrAux);
  905 + }
  906 + } // end foreach
  907 + }
  908 + if (empty ($_list))
  909 + $_list = false;
  910 +
  911 + return $_list;
  912 + } // end Function getLangArray4List
  913 +
  914 + /**
  915 + * Constroi os arrays de traducao e listagem de idioma padrao
  916 + *
  917 + * @access private
  918 + */
  919 + function buildArrayVars() {
  920 + $this->arrLanguageLang = $this->getLangArray4Translate();
  921 + $this->arrLanguageList = $this->getLangArray4List();
  922 + if (!empty ($this->arrLanguageLang))
  923 + ksort($this->arrLanguageLang);
  924 + if (!empty ($this->arrLanguageList))
  925 + ksort($this->arrLanguageList);
  926 + } // end Function buildArrayVars
  927 +
  928 + /**
  929 + * Constroi string de conteudo do arquivo a ser salvo
41 * 930 *
42 - * @category PHP-Tool  
43 - * @package phpTranslator  
44 - * @author Adriano dos Santos Vieira (harpiain) <harpiain@users.sourceforge.net>  
45 - * @copyright 2005-2007 Adriano dos Santos Vieira  
46 - * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL License 3.0  
47 - * @version subVersion: $Id: phpTranslator, v 0.2.0-40 feb/23/2006 $  
48 - * @link http://obiblioopac4j.sourceforge.net  
49 - * @see Translator()  
50 - * @since File available since Release 0.0.1  
51 - * @todo The package TODO/Roadmap are: {@example ToDo.txt} 931 + * @access private
  932 + * @param array $_lang_tgt_text_file Idioma a ser salvo
52 */ 933 */
53 - 934 + function buildStr4File($_lang_tgt_text_file) {
  935 + $_new_target_file = "";
  936 + if (is_array($_lang_tgt_text_file)) {
  937 + foreach ($_lang_tgt_text_file as $_keys => $_values) {
  938 + $_text_test = $this->stripContraBarra(trim($_values['text']) . trim($_values['abbr']));
  939 + $_keyCode = $this->stripContraBarra($_values['code']);
  940 + if (!$_keyCode)
  941 + $_keyCode = $this->stripContraBarra($_keys);
  942 + if (!empty ($_text_test)) {
  943 + $_new_target_file .= $this->stripContraBarra($_values['lang']) .
  944 + $this->_spaces($this->messageCountryLen - strlen($this->stripContraBarra($_values['lang'])));
  945 + $_new_target_file .= $_keyCode .
  946 + $this->_spaces($this->messageCodeLen - strlen($_keyCode));
  947 +
  948 + $_new_target_file .= $this->stripContraBarra($_values['context']) .
  949 + $this->_spaces($this->messageContextLen - strlen($this->stripContraBarra($_values['context'])));
  950 + $_new_target_file .= $this->stripContraBarra($_values['type']) .
  951 + $this->_spaces($this->messageTypeLen - strlen($this->stripContraBarra($_values['type'])));
  952 + $_new_target_file .= $this->stripContraBarra($_values['abbr']) .
  953 + $this->_spaces($this->messageAbbrLen - strlen($this->stripContraBarra($_values['abbr'])));
  954 + $_new_target_file .= $this->stripContraBarra($_values['text']);
  955 + $_new_target_file .= T_CRLF;
  956 + }
  957 + }
  958 + } else {
  959 + $this->Error = true;
  960 + $this->mensagem = $this->getText('#phptranslator_array parameter required#');
  961 + if ($this->inDebugMode())
  962 + echo "phpTranslator: " . $this->getMessage();
  963 + $_new_target_file = false;
  964 + }
  965 +
  966 + return $_new_target_file;
  967 + } // end Function buildStr4File
  968 +
54 /** 969 /**
55 - * Constante que define o "ENTER" e o "SALTO DE LINHA" nos arquivos de idiomas 970 + * Salva o arquivo de idioma conforme definido nos padroes
  971 + *
56 * @access private 972 * @access private
  973 + * @param string $_content_to_file Texto/conteudo do arquivo a ser salvo
  974 + * @param string $_abbr_i18n Idioma do arquivo a ser salvo- se nao informado busca o idioma padrao
  975 + * @param boolean $_file_increment Se o conteudo do arquivo sera incrementado - padrao eh sobrescrever
  976 + * @return boolean se o arquivo foi salvo ou nao
57 */ 977 */
58 - define ( T_CRLF, chr(13).chr(10) );  
59 - 978 + function saveLangFile($_content_to_file, $_abbr_i18n = "", $_file_increment = false) {
  979 +
  980 + if (empty ($_abbr_i18n))
  981 + $_abbr_i18n = $this->languageStd;
  982 +
  983 + $_file_name = $this->_makeFileName($_abbr_i18n);
  984 +
  985 + $this->error = true;
  986 + $this->mensagem = "";
  987 +
  988 + if (is_writable($this->languageFilePath)) {
  989 + if (is_writable($_file_name) or !file_exists($_file_name)) {
  990 + if (($_file_increment) and file_exists($_file_name))
  991 + $_resource = @ fopen($_file_name, 'w+');
  992 + else
  993 + $_resource = @ fopen($_file_name, 'w');
  994 +
  995 + if ($_resource) {
  996 + fwrite($_resource, $_content_to_file);
  997 + fclose($_resource);
  998 + } else {
  999 + $this->mensagem = $this->getText('#phptranslator_file#') . " ($_file_name) " . $this->getText('#phptranslator_without write permition#');
  1000 + if ($this->inDebugMode())
  1001 + echo "phpTranslator: " . $this->getMessage();
  1002 + $this->error = false;
  1003 + }
  1004 + } else {
  1005 + $this->mensagem = $this->getText('#phptranslator_file#') . " ($_file_name) " . $this->getText('#phptranslator_without write permition#');
  1006 + if ($this->inDebugMode())
  1007 + echo "phpTranslator: " . $this->getMessage();
  1008 + $this->error = false;
  1009 + }
  1010 + } else {
  1011 + $this->mensagem = $this->getText('#phptranslator_directory#') . " ($this->languageFilePath) " . $this->getText('#phptranslator_without write permition#');
  1012 + if ($this->inDebugMode())
  1013 + echo "phpTranslator: " . $this->getMessage();
  1014 + $this->error = false;
  1015 + }
  1016 +
  1017 + return $this->error;
  1018 + } // end func: SaveFile
  1019 +
  1020 + /*
  1021 + * Metodos PRIVATE
  1022 + */
  1023 +
60 /** 1024 /**
61 - * Constante que define a cor do texto ainda nao traduzido 1025 + * Atribui o idioma padrao para a aplicacao
  1026 + *
62 * @access private 1027 * @access private
  1028 + * @param string $_abbr_i18n ISO do Idioma da aplicacao
63 */ 1029 */
64 - define ( T_BG_COLOR_TRADUZ, "#e7d4d4" ); 1030 + function setLangSrc($_abbr_i18n) {
  1031 + $this->languageStd = $_abbr_i18n;
  1032 + } // end func: setLangSrc
65 1033
66 /** 1034 /**
67 - * Constrante que define se apenas traducao 1035 + * Atribui o idioma do usuario
  1036 + *
68 * @access private 1037 * @access private
  1038 + * @param string $_abbr_i18n ISO do Idioma do usuario
69 */ 1039 */
70 - define( T_TRANSLATOR, true );  
71 - 1040 + function setLangUser($_abbr_i18n) {
  1041 + $this->languageUser = $_abbr_i18n;
  1042 + } // end func: setLangUser
  1043 +
72 /** 1044 /**
73 - * Constante que define se codificacao e traducao 1045 + * Atribui o idioma do destino na traducao
  1046 + *
74 * @access private 1047 * @access private
  1048 + * @param string $_abbr_i18n ISO do Idioma target
75 */ 1049 */
76 - define( T_CODER , false ); 1050 + function setLangTgt($_abbr_i18n) {
  1051 + $this->setLangUser($_abbr_i18n);
  1052 + } // end func: setLangTgt
  1053 +
  1054 + /**
  1055 + * Monta o nome do arquivo de idiomas
  1056 + * @access private
  1057 + *
  1058 + * @param string $_abbr_i18n Codigo ISO do idioma a ser usado
  1059 + *
  1060 + * @return string O nome do arquivo (incluindo o path)
  1061 + */
  1062 + function _makeFileName($_abbr_i18n) {
  1063 + if (empty ($_abbr_i18n))
  1064 + $_abbr_i18n = $this->languageUser;
  1065 +
  1066 + $_file_name = $this->languageFilePath;
  1067 + if ($this->languageFilesubdir)
  1068 + $_file_name .= $_abbr_i18n . "/";
  1069 +
  1070 + $_file_name .= $this->languageFilePrefix;
  1071 + if ($this->languageFileInSections)
  1072 + if (!empty ($this->languageSectionActive))
  1073 + $_file_name .= $this->languageSectionActive . ".";
  1074 +
  1075 + $_file_name .= $_abbr_i18n;
  1076 + $_file_name .= $this->languageFileSufix;
  1077 + $this->error = false;
  1078 +
  1079 + if (!is_file($_file_name)) {
  1080 + $this->mensagem = $this->getText('#phptranslator_file#') . " ($_file_name) " . $this->getText('#phptranslator_not found#');
  1081 + if ($this->inDebugMode())
  1082 + echo "phpTranslator: " . $this->getMessage();
  1083 + $this->error = true;
  1084 + }
  1085 +
  1086 + return $_file_name;
  1087 +
  1088 + } // end func: MakeFileName
  1089 +
  1090 + /**
  1091 + * Monta o nome do arquivo de idiomas
  1092 + * @access private
  1093 + *
  1094 + * @param string $_abbr_i18n Codigo ISO do idioma a ser usado
  1095 + *
  1096 + * @return string O nome do arquivo (incluindo o path)
  1097 + */
  1098 + function _getExternalFile($_filename, $_abbr_i18n) {
  1099 + $_file_content = "";
  1100 + $_file_name = $this->languageFilePath;
  1101 + if ($this->languageFilesubdir)
  1102 + $_file_name .= $_abbr_i18n . DIRECTORY_SEPARATOR;
  1103 + $_file_name .= $_filename;
  1104 +
  1105 + $this->error = false;
  1106 +
  1107 + if (!is_file($_file_name) and !is_readable($_file_name)) {
  1108 + $this->mensagem = $this->getText('#phptranslator_file#') . " ($_file_name) " . $this->getText('#phptranslator_not found#');
  1109 + $_file_content = $this->mensagem;
  1110 + if ($this->inDebugMode())
  1111 + echo "phpTranslator: " . $this->getMessage();
  1112 + $this->error = true;
  1113 + } else {
  1114 + $_file_content = file_get_contents($_file_name);
  1115 + }
  1116 +
  1117 + return $_file_content;
  1118 +
  1119 + } // end func: getExternalFile
  1120 +
  1121 + /**
  1122 + * Idioma a ser traduzido para a aplicacao.
  1123 + * Se o preferido pelo usuario ou o do Browser em uso ou o padrao da aplicacao
  1124 + * @access private
  1125 + */
  1126 + function _getLanguage() {
  1127 +
  1128 + // faz insercao dos textos padroes para a aplicacao (conforme o idioma
  1129 + $_language = "";
  1130 + if (!empty ($this->languageUser))
  1131 + $_language = $this->languageUser;
  1132 + elseif (!empty ($this->_browserLanguage)) $_language = $this->_browserLanguage;
  1133 + else
  1134 + $_language = $this->languageStd;
  1135 +
  1136 + return $_language;
  1137 + } // end func: _getLanguage
  1138 +
  1139 + /**
  1140 + * Busca o texto a ser traduzido dentro do array de idiomas
  1141 + *
  1142 + * Busca a traducao do texto - caso o texto traduzido nao exista retorna o texto padrao e caso este
  1143 + * tambem nao exista retorna o codigo de pesquisa
  1144 + *
  1145 + * @access private
  1146 + * @param string $_msg_code O codigo da mensagem a ser traduzida
  1147 + * @param boolean $_sigla Se retorna a sigla em lugar da mensagem completa
  1148 + * @param boolean $_text_case Se o texto retorna o texto como cadastrado, em maiusculas ou minusculas
  1149 + * 1 - maiuscula
  1150 + * 2 - minuscula
  1151 + * outro - como estiver cadastrado
  1152 + * @param array $_args Sao os argumentos que serão inseridos na mensagem nas posições onde houver %N
  1153 + * (onde N é a quantidade sequencial de parâmetros)
  1154 + *
  1155 + * @return string O texto traduzido, o texto padrao ou o codigo da mensagem
  1156 + *
  1157 + */
  1158 + function _getStdText($_msg_code = '', $_sigla = false, $_text_case = 0, $_args = array ()) {
  1159 + if (!empty ($_msg_code))
  1160 + /*
  1161 + * - A chave de procura deve estar em minusculas bem como o conteudo do arquivo de idiomas
  1162 + */
  1163 + $_key_lower_text = strtolower($_msg_code);
  1164 +
  1165 + $_lang_array_aux = $this->translated_text[$this->_getLanguage()];
  1166 + if (@ array_key_exists($_key_lower_text, $_lang_array_aux)) {
  1167 + if (@ array_key_exists('type', $_lang_array_aux[$_key_lower_text]) and ($_lang_array_aux[$_key_lower_text]['type'] == 'arquivo' or $_lang_array_aux[$_key_lower_text]['type'] == 'file')) {
  1168 + if (@ array_key_exists('text', $_lang_array_aux[$_key_lower_text])) {
  1169 + $_file_name = $_lang_array_aux[$_key_lower_text]['text'];
  1170 + $_msg_code_aux = $this->_getExternalFile($_file_name, $this->languageUser);
  1171 + }
  1172 + }
  1173 + elseif (@ array_key_exists('text', $_lang_array_aux[$_key_lower_text])) {
  1174 + $_msg_code_aux = $_lang_array_aux[$_key_lower_text]['text'];
  1175 + if ($_sigla)
  1176 + if (@ array_key_exists('abbr', $_lang_array_aux[$_key_lower_text]))
  1177 + $_msg_code_aux = $_lang_array_aux[$_key_lower_text]['abbr'];
  1178 + }
  1179 + } else {
  1180 + $_lang_array_aux = $this->translatedTextStd;
  1181 + if (@ array_key_exists($_key_lower_text, $_lang_array_aux)) {
  1182 + if (@ array_key_exists('type', $_lang_array_aux[$_key_lower_text]) and ($_lang_array_aux[$_key_lower_text]['type'] == 'arquivo' or $_lang_array_aux[$_key_lower_text]['type'] == 'file')) {
  1183 + if (@ array_key_exists('text', $_lang_array_aux[$_key_lower_text])) {
  1184 + $_file_name = $_lang_array_aux[$_key_lower_text]['text'];
  1185 + $_msg_code_aux = $this->_getExternalFile($_file_name, $this->languageStd);
  1186 + }
  1187 + }
  1188 + elseif (@ array_key_exists('text', $_lang_array_aux[$_key_lower_text])) {
  1189 + $_msg_code_aux = $_lang_array_aux[$_key_lower_text]['text'];
  1190 + if ($_sigla)
  1191 + if (@ array_key_exists('abbr', $_lang_array_aux[$_key_lower_text]))
  1192 + $_msg_code_aux = $_lang_array_aux[$_key_lower_text]['abbr'];
  1193 + }
  1194 + } else {
  1195 + $_lang_array_aux = $this->translatedTextSelf;
  1196 + if (@ array_key_exists($_key_lower_text, $_lang_array_aux)) {
  1197 + if (@ array_key_exists('text', $_lang_array_aux[$_key_lower_text])) {
  1198 + $_msg_code_aux = $_lang_array_aux[$_key_lower_text]['text'];
  1199 + if ($_sigla)
  1200 + if (@ array_key_exists('abbr', $_lang_array_aux[$_key_lower_text]))
  1201 + $_msg_code_aux = $_lang_array_aux[$_key_lower_text]['abbr'];
  1202 + }
  1203 + }
  1204 + }
  1205 + }
  1206 +
  1207 + switch ($_text_case) {
  1208 + case 1 : // tudo em minusculas
  1209 + $_msg_code_aux = strtolower($_msg_code_aux);
  1210 + break;
  1211 + case 2 : // tudo em maiusculas
  1212 + $_msg_code_aux = strtoupper($_msg_code_aux);
  1213 + break;
  1214 + }
  1215 +
  1216 + if (empty ($_msg_code_aux))
  1217 + $_msg_code_aux = $_msg_code;
  1218 +
  1219 + $_argcPercentage = substr_count($_msg_code_aux, "%");
  1220 + if ($_argcPercentage > 0) { // tem % no texto
  1221 + // substitui os %n do texto pelos parametros do array de argumentos
  1222 + for ($i = 0; $i < $_argcPercentage; $i++) {
  1223 + $_argsValue = "%" . ($i +1);
  1224 + if (strpos($_msg_code_aux, $_argsValue) <> 0) {
  1225 + $_msg_code_aux = str_replace($_argsValue, $_args[$i], $_msg_code_aux);
  1226 + }
  1227 + }
  1228 + }
  1229 +
  1230 + return $_msg_code_aux;
  1231 + } // end func: _getStdText
  1232 +
  1233 + /**
  1234 + * Monta uma string contendo espacos em branco
  1235 + * @access private
  1236 + * @param int $_num Numero de espacos que a string contera
  1237 + * @return string Espacos em branco
  1238 + */
  1239 + function _spaces($_num = 0) {
  1240 + if ($_num > 0)
  1241 + for ($_inc = 1; $_inc <= $_num; $_inc++) {
  1242 + $_spaces .= " ";
  1243 + }
  1244 + return $_spaces;
  1245 + } // end func: _spaces
  1246 +
  1247 + /**
  1248 + * cria template para a propria classe usar
  1249 + * @access private
  1250 + * @return patTemplate
  1251 + */
  1252 + function & _createTemplate() {
  1253 + global $option, $mosConfig_absolute_path;
  1254 +
  1255 + if (defined('_VALID_MOS')) {
  1256 + require_once ($mosConfig_absolute_path . '/includes/patTemplate/patTemplate.php');
  1257 + $tmpl = & patFactory :: createTemplate();
  1258 + $tmpl->setRoot(dirname(__FILE__) . '/templates');
  1259 + } else {
  1260 + require_once ($this->classSelfPath . '/classes/pat/patErrorManager.php');
  1261 + require_once ($this->classSelfPath . '/classes/pat/patTemplate.php');
  1262 + $tmpl = new patTemplate();
  1263 + $tmpl->setNamespace("mos");
  1264 + }
  1265 + $this->_objTmpl = $tmpl;
  1266 + return $tmpl;
  1267 + } // end func: _createTemplate
  1268 +
  1269 + /**
  1270 + * Salvar dados apos alteracoes ou exclusoes de mensagens codificadas
  1271 + *
  1272 + * @access private
  1273 + */
  1274 + function _langSave($_lang_target, $_abbr_i18n_save) {
  1275 + $_text4file = $this->buildStr4File($_lang_target);
  1276 + if (!is_bool($_text4file)) {
  1277 + $_saved = $this->saveLangFile($_text4file, $_abbr_i18n_save);
  1278 + if (!$_saved)
  1279 + if ($this->inDebugMode())
  1280 + echo $this->getMessage();
  1281 + }
  1282 + elseif (!($_text4file)) if ($this->inDebugMode())
  1283 + echo $this->getMessage();
  1284 + } // end func: _langSave
  1285 +
  1286 + /**
  1287 + * Excluir mensagem do idioma padrao
  1288 + *
  1289 + * @access private
  1290 + * @param array $_lang_data_selected Dado do idioma padrao a ser excluido
  1291 + *
  1292 + */
  1293 + function _langCodeDelete($_lang_data_selected) {
  1294 + foreach ($_lang_data_selected as $_keys => $_key) {
  1295 + unset ($this->translatedTextStd[$this->stripContraBarra($_keys)]);
  1296 + }
  1297 + } // end func: _langCodeDelete
  1298 +
  1299 + /**
  1300 + * Busca o arquivo de idiomas
  1301 + *
  1302 + * @access private
  1303 + * @param string $_abbr_i18n O codigo ISO do idioma a ser tratado
  1304 + *
  1305 + * @return array Contem os dados do idioma
  1306 + */
  1307 + function _getLangFile($_abbr_i18n = "") {
  1308 +
  1309 + $this->error = false;
  1310 +
  1311 + if (empty ($_abbr_i18n))
  1312 + $_abbr_i18n = $this->languageStd;
  1313 +
  1314 + $_src_file_name = $this->_makeFileName($_abbr_i18n);
  1315 +
  1316 + if (!file_exists($_src_file_name)) {
  1317 + $this->mensagem = $this->getText('#phptranslator_language file#') . " ($_src_file_name) " .
  1318 + $this->getText('#phptranslator_not found#');
  1319 + if ($this->inDebugMode())
  1320 + echo "phpTranslator: " . $this->getMessage();
  1321 + $this->error = true;
  1322 + return false;
  1323 + }
  1324 +
  1325 + $_src_file = file($_src_file_name);
  1326 +
  1327 + // monta idioma padrao
  1328 + foreach ($_src_file as $_keys => $_values) {
  1329 + $_lang = trim(substr($_values, 0, $this->messageCountryLen));
  1330 + $_msg_code = strtolower(trim(substr($_values, $this->messageCountryLen, $this->messageCodeLen)));
  1331 +
  1332 + $_str_start_aux = $this->messageCountryLen + $this->messageCodeLen;
  1333 + $_msg_context = trim(substr($_values, $_str_start_aux, $this->messageContextLen));
  1334 +
  1335 + $_str_start_aux = $this->messageCountryLen + $this->messageCodeLen + $this->messageContextLen;
  1336 + $_msg_type = trim(substr($_values, $_str_start_aux, $this->messageTypeLen));
  1337 +
  1338 + $_str_start_aux = $this->messageCountryLen + $this->messageCodeLen + $this->messageContextLen + $this->messageTypeLen;
  1339 + $_msg_abbr = trim(substr($_values, $_str_start_aux, $this->messageAbbrLen));
  1340 +
  1341 + $_str_start_aux = $this->messageCountryLen + $this->messageCodeLen + $this->messageContextLen + $this->messageTypeLen + $this->messageAbbrLen;
  1342 + $_msg_text = trim(substr($_values, $_str_start_aux));
  1343 +
  1344 + $_language_data[$_lang][$_msg_code]['text'] = $_msg_text;
  1345 + $_language_data[$_lang][$_msg_code]['context'] = $_msg_context;
  1346 + $_language_data[$_lang][$_msg_code]['type'] = $_msg_type;
  1347 + $_language_data[$_lang][$_msg_code]['abbr'] = $_msg_abbr;
  1348 + $_language_data[$_lang][$_msg_code]['lang'] = $_abbr_i18n;
  1349 + }
  1350 +
  1351 + @ asort($_language_data[$_abbr_i18n]);
  1352 +
  1353 + return $_language_data[$_abbr_i18n];
  1354 +
  1355 + } // end func: _getLangFile
  1356 +
  1357 + /**
  1358 + * Insere novos idiomas a traduzir
  1359 + * @access private
  1360 + * @param boolean $_length Tamnho a ser atribuido
  1361 + */
  1362 + function _createLanguageDef($_objTmpl) {
  1363 + $_objTmpl->readTemplatesFromInput( 'translate_createlang.html' );
  1364 + $_objTmpl->addVar( 'translate_langdef', 'BTN_SALVAR',
  1365 + $this->getText('#phptranslator_salvar#') );
  1366 + $_objTmpl->addVar( 'translate_langdef', 'BTN_CANCELAR',
  1367 + $this->getText('#phptranslator_cancelar#') );
  1368 + $_objTmpl->addVar( 'translate_langdef', 'BTN_RESTAURAR',
  1369 + $this->getText('#phptranslator_restaurar#') );
  1370 +
  1371 + $_objTmpl->displayParsedTemplate('translate_langdef');
  1372 + } // end func: _insertLanguageDef
  1373 +
  1374 + /**
  1375 + * Atribui o tamanho do campo de codigo (abbrI18N) do idioma
  1376 + * @access public
  1377 + * @param boolean $_length Tamnho a ser atribuido
  1378 + */
  1379 + function setLangCountryLength($_length) {
  1380 + $this->messageCountryLen = $_length;
  1381 + } // end func: setLangCountryLength
  1382 +
  1383 + /**
  1384 + * Atribui o tamanho do campo de codigo da messagem
  1385 + * @access public
  1386 + * @param boolean $_length Tamnho a ser atribuido
  1387 + */
  1388 + function setLangMsgCodeLength($_length) {
  1389 + $this->messageCodeLen = $_length;
  1390 + } // end func: setLangMsgCodeLength
  1391 +
  1392 + /**
  1393 + * Atribui o tamanho do campo de tipo da messagem
  1394 + * @access public
  1395 + * @param boolean $_length Tamnho a ser atribuido
  1396 + */
  1397 + function setLangMsgTypeLength($_length) {
  1398 + $this->messageTypeLen = $_length;
  1399 + } // end func: setLangMsgTypeLength
  1400 +
  1401 + /**
  1402 + * Atribui o tamanho do campo de contexto da messagem
  1403 + * @access public
  1404 + * @param boolean $_length Tamnho a ser atribuido
  1405 + */
  1406 + function setLangMsgContextLength($_length) {
  1407 + $this->messageContextLen = $_length;
  1408 + } // end func: setLangMsgContextLength
  1409 +
  1410 + /**
  1411 + * Atribui o tamanho do campo da abreviatura da messagem
  1412 + * @access public
  1413 + * @param boolean $_length Tamnho a ser atribuido
  1414 + */
  1415 + function setLangMsgAbbrLength($_length) {
  1416 + $this->messageAbbrLen = $_length;
  1417 + } // end func: setLangMsgAbbrLength
  1418 +
  1419 + /**
  1420 + * Atribui que o caminho dos arquivos de idiomas ficarao em subdiretorios abbrI18N
  1421 + * @access public
  1422 + * @param boolean $_filesInSubDirs TRUE - em subdiretorio abbrI18N
  1423 + * FALSE - sem subdiretorio abbrI18N (default)
  1424 + */
  1425 + function setLangFilesInSubDirs($_filesInSubDirs = false) {
  1426 + $this->languageFilesubdir = $_filesInSubDirs;
  1427 + } // end func: setLangFilesInSubDir
  1428 +
  1429 + /**
  1430 + * Atribui que os arquivos de idiomas serao seccionados conforme contextualizacao
  1431 + * @access public
  1432 + * @param boolean $_filesInSections TRUE - seccionados
  1433 + * FALSE - nao seccionados (default)
  1434 + */
  1435 + function setLangFilesInSections($_filesInSections = false) {
  1436 + $this->languageFileInSections = $_filesInSections;
  1437 + } // end func: setLangFilesInSections
  1438 +
  1439 + /**
  1440 + * Atribui a secao ativa a ser mostrada a TAG em "showTagHeader"
  1441 + * @access public
  1442 + * @param string $_activeSection O nome da seccao ativa (ex: admin ou setup)
  1443 + * Obs: Deve ser o nome interno e nao a traducao
  1444 + */
  1445 + function setActiveSection($_activeSection = "") {
  1446 + $this->languageSectionActive = $_activeSection;
  1447 + } // end func: setActiveSection
  1448 +
  1449 + /**
  1450 + * Busca a secao ativa a ser mostrada a TAG em "showTagHeader"
  1451 + * @access public
  1452 + * @return string $_activeSection O nome da seccao ativa (ex: admin ou setup)
  1453 + */
  1454 + function getActiveSection() {
  1455 + return $this->languageSectionActive;
  1456 + } // end func: getActiveSection
  1457 +
  1458 + /**
  1459 + * Se necessario remove a contra barra do texto
  1460 + * @access private
  1461 + * @param string $_text O texto a ser tratado
  1462 + */
  1463 + function stripContraBarra($_text) {
  1464 + if (get_magic_quotes_gpc()) {
  1465 + $_text = stripslashes($_text);
  1466 + }
  1467 +
  1468 + return $_text;
  1469 + } // end stripContraBarra
  1470 +
  1471 + /**
  1472 + * Ativa o modo "debug" do phpTranslator passando a mostrar as mensagens internas
  1473 + * @access public
  1474 + */
  1475 + function debugOn() {
  1476 + $this->_debugTranslator = true;
  1477 + } // end debugOn
  1478 +
  1479 + /**
  1480 + * Desativa o modo "debug" do phpTranslator deixando de mostrar as mensagens internas
  1481 + * @access public
  1482 + */
  1483 + function debugOff() {
  1484 + $this->_debugTranslator = false;
  1485 + } // end debugOff
  1486 +
  1487 + /**
  1488 + * Desativa o modo "debug" do phpTranslator deixando de mostrar as mensagens internas
  1489 + * @access public
  1490 + * @return boolean - True = em modo "debug"; FALSE = nao esta em modo "debug"
  1491 + */
  1492 + function inDebugMode() {
  1493 + return $this->_debugTranslator;
  1494 + } // end inDebugMode
77 1495
78 /** 1496 /**
79 - * Classe para realizar a traducao de um texto com base em arquivos pre-definidos  
80 - *  
81 - * As aplicacoes baseadas nessa classe deverao adaptar-se ao modo como esta classe <br>  
82 - * monta os arquivos de idiomas e seus requisitos de codificacao de idioma.  
83 - *  
84 - * @category PHP-Tool  
85 - * @package phpTranslator  
86 - * @author Adriano dos Santos Vieira (harpiain) <harpiain@users.sourceforge.net> 1497 + * Dump de variavies
  1498 + * @access public
87 */ 1499 */
88 - Class Translator {  
89 -  
90 - /**  
91 - * path para para a propria classe  
92 - * @access private  
93 - * @var string  
94 - */  
95 - var $classSelfPath = "./";  
96 -  
97 - /**  
98 - * path relativo (URL) para a classe  
99 - * @access private  
100 - * @var string  
101 - */  
102 - var $translatorUrlPath = "./";  
103 -  
104 - /**  
105 - * path para o arquivo de mensagens  
106 - * @access private  
107 - * @var sting  
108 - */  
109 - var $languageFilePath = "./";  
110 -  
111 - /**  
112 - * prefixo para o arquivo de mensagens  
113 - * @access private  
114 - * @var $languageFilePrefix  
115 - */  
116 - var $languageFilePrefix = "language.";  
117 -  
118 -  
119 - /**  
120 - * sufixo para o arquivo de mensagens  
121 - * @access private  
122 - * @var string  
123 - */  
124 - var $languageFileSufix = ".inc.php";  
125 -  
126 - /**  
127 - * contera as mensagens a serem exibidas para a aplicacao de 2 idiomas (source and target)  
128 - *  
129 - * @access private  
130 - * @var array  
131 - */  
132 - var $translated_text = "";  
133 -  
134 - /**  
135 - * contera as mensagens padrao  
136 - *  
137 - * @access private  
138 - * @var array  
139 - */  
140 - var $translatedTextStd = array();  
141 -  
142 - /**  
143 - * contera as mensagens traduzidas (ex: en-us)  
144 - *  
145 - * @access private  
146 - * @var array  
147 - */  
148 - var $translatedTextTgt = array();  
149 -  
150 - /**  
151 - * contera as mensagens da propria classe traduzidas ou padrao  
152 - *  
153 - * @access private  
154 - * @var array  
155 - * @since v 0.2.0-40  
156 - */  
157 - var $translatedTextSelf = array();  
158 -  
159 - /**  
160 - * padrao da aplicacao  
161 - *  
162 - * @access private  
163 - * @var string  
164 - */  
165 - var $languageStd = "pt-br";  
166 -  
167 - /**  
168 - * preferencia do usuario  
169 - * @access private  
170 - * @var string  
171 - */  
172 - var $languageUser = "";  
173 -  
174 - /**  
175 - * se traduz textos padrao conforme idioma:  
176 - * TRUE - tenta traduzir todos os textos;  
177 - * FALSE - nao traduz os textos  
178 - *  
179 - * @access private  
180 - * @var boolean  
181 - */  
182 - var $translateMessage = true;  
183 -  
184 - /**  
185 - * se os arquivos de idioma estarao em sub-diretorios, conforme abrevitura ISO I18N  
186 - * ex: pt-br/language.pt-br.inc.php, en/language.en.inc.php ...  
187 - * TRUE - os arquivos estarao em subdiretorios;  
188 - * FALSE - os arquivos nao estarao em subdiretorios  
189 - *  
190 - * @access private  
191 - * @var boolean  
192 - * @since v 0.2.0-40  
193 - */  
194 - var $languageFilesubdir = false;  
195 -  
196 - /**  
197 - * se os arquivos de idioma estarao seccionados, conforme contextualizacao  
198 - * ex: prefix.SECTION.sufix == language.admin.pt-br.inc.php ...  
199 - * TRUE - os arquivos estarao seccionados;  
200 - * FALSE - os arquivos nao estarao seccionados  
201 - *  
202 - * @access private  
203 - * @var boolean  
204 - * @since v 0.2.0-40  
205 - */  
206 - var $languageFileInSections = false;  
207 -  
208 - /**  
209 - * devera conter as secoes dos arquivos de idiomas, conforme contextualizacao  
210 - *  
211 - * <code>  
212 - * ...  
213 - * $_lang_sections = array('phpTranslator' => 'textos da classe de traducao',  
214 - * 'admin' => 'Textos da secao administrativa',  
215 - * 'home' => 'textos da secao principal',  
216 - * 'and son on' => 'e assim por diante...');  
217 - * ...  
218 - * </code>  
219 - * @access private  
220 - * @var array  
221 - * @since v 0.2.0-40  
222 - */  
223 - var $languageSections = array();  
224 -  
225 - /**  
226 - * devera conter a secao ativa a ser mostrada/traduzida, quando fizer uso de secoes  
227 - *  
228 - * @access private  
229 - * @var array  
230 - * @since v 0.2.0-40  
231 - */  
232 - var $languageSectionActive = "";  
233 -  
234 - /**  
235 - * possiveis mensagens retornadas pela classe  
236 - * @access private  
237 - * @var string  
238 - */  
239 - var $mensagem = "";  
240 -  
241 - /**  
242 - * se ocorreu erro em um metodo - true = ocorreu erro; false = nao ocorreu erro  
243 - * @access private  
244 - * @var boolean  
245 - */  
246 - var $error = false;  
247 -  
248 - /**  
249 - * Tamanho para o codigo do idioma  
250 - * @var numeric  
251 - * @access private  
252 - */  
253 - var $messageCountryLen = 10;  
254 -  
255 - /**  
256 - * Tamanho para o codigo da mensagem  
257 - * @var numeric  
258 - * @access private  
259 - */  
260 - var $messageCodeLen = 100;  
261 -  
262 - /**  
263 - * Tamanho para o tipo da mensagem  
264 - * @var numeric  
265 - * @access private  
266 - */  
267 - var $messageTypeLen = 10;  
268 -  
269 - /**  
270 - * Tamanho para a abreviacao  
271 - * @var numeric  
272 - * @access private  
273 - */  
274 - var $messageAbbrLen = 10;  
275 -  
276 - /**  
277 - * Tamanho para o contextualizacao (ex: admin, config, preferences, front-end etc)  
278 - * @var numeric  
279 - * @access private  
280 - */  
281 - var $messageContextLen = 10;  
282 -  
283 - /**  
284 - * contera as mensagens a serem exibidas para traducao  
285 - *  
286 - * @access private  
287 - * @var array  
288 - */  
289 - var $arrLanguageLang = array();  
290 -  
291 - /**  
292 - * contera as mensagens a serem listadas  
293 - *  
294 - * @access private  
295 - * @var array  
296 - */  
297 - var $arrLanguageList = array();  
298 -  
299 - /**  
300 - * idioma do browser  
301 - * @var string  
302 - * @access private  
303 - */  
304 - var $_browserLanguage = '';  
305 -  
306 - /**  
307 - * Se mostra todas as mensagens geradas pela aplicacao  
308 - * @var boolean  
309 - * @access private  
310 - */  
311 - var $_debugTranslator = false;  
312 -  
313 - /**  
314 - * Objeto template  
315 - * @var object  
316 - * @access private  
317 - */  
318 - var $_objTmpl;  
319 -  
320 - /**  
321 - * Metodo contrutor para realizar a traducao de um texto com base em arquivos pre-definidos  
322 - * @access public  
323 - * @name Translator  
324 - * @param string $_abbr_i18n_tgt - Deve ser informado o idioma destino para a aplicacao  
325 - * @param string $_langFilePath - path para o arquivo de mensagens  
326 - * @param string $_abbr_i18n_src - Deve ser informado o idioma padrao da aplicacao  
327 - * (padrao "en" = English)  
328 - */  
329 - function Translator( $_abbr_i18n_tgt='', $_langFilePath='', $_abbr_i18n_src='en-us' ) {  
330 -  
331 - $_browserLanguage = $_SERVER['HTTP_ACCEPT_LANGUAGE'];  
332 - if(strpos($_browserLanguage, ",")) {  
333 - $_browserLanguage = substr($_browserLanguage,0,strpos($_browserLanguage, ","));  
334 - }  
335 - $this->_browserLanguage = $_browserLanguage;  
336 -  
337 - $this->classSelfPath = dirname(__FILE__);  
338 -  
339 - if(!empty($_abbr_i18n_src))  
340 - $this->SetLanguage($_abbr_i18n_src);  
341 -  
342 - if(!empty($_abbr_i18n_tgt))  
343 - $this->SetLanguage($_abbr_i18n_tgt,'target');  
344 -  
345 - /*  
346 - * busca a propia traducao  
347 - */  
348 - $this->setLangFilePath( $this->classSelfPath."/languages/" );  
349 - $this->translatedTextSelf = $this->_getLangFile($_abbr_i18n_tgt);  
350 - if($this->error) {  
351 - $this->translatedTextSelf = $this->_getLangFile($_abbr_i18n_src);  
352 - if($this->error) {  
353 - $this->translatedTextSelf = $this->_getLangFile("en-us");  
354 - }  
355 - }  
356 -  
357 - if( !empty($_langFilePath) )  
358 - $this->setLangFilePath( $_langFilePath );  
359 -  
360 - } // end func: Translator  
361 -  
362 - /**  
363 - * Prove a interface de cadastramento de codigos de mensagems ou a de traducao  
364 - *  
365 - * @access public  
366 - * @param boolean $_translate_only FALSE - Se apenas para traduzir  
367 - * TRUE - tambem para fazer manutencao (default)  
368 - */  
369 - function translatorGUI( $_translate_only=true ) {  
370 -  
371 - // objeto para o template  
372 - $_objTmpl =& $this->_createTemplate();  
373 - $_objTmpl->setRoot( $this->classSelfPath.'/templates' );  
374 -  
375 - // Dados de inicializacao  
376 - if(!isset($_POST['mnt_lang_action'])) $_langAction = 'listar';  
377 - elseif(array_key_exists('tradutor', $_POST['mnt_lang_action'])) $_langAction = 'tradutor';  
378 - elseif(array_key_exists('inserir', $_POST['mnt_lang_action'])) $_langAction = 'inserir';  
379 - elseif(array_key_exists('alterar', $_POST['mnt_lang_action'])) $_langAction = 'alterar';  
380 - elseif(array_key_exists('excluir', $_POST['mnt_lang_action'])) $_langAction = 'excluir';  
381 - elseif(array_key_exists('listar', $_POST['mnt_lang_action'])) $_langAction = 'listar';  
382 - elseif(array_key_exists('salvar', $_POST['mnt_lang_action'])) $_langAction = 'salvar';  
383 -  
384 - if(!empty($_POST['tag_active']))  
385 - $this->languageSectionActive = $_POST['tag_active'];  
386 -  
387 - $this->initStdLanguages();  
388 -  
389 - $_list_lang = false;  
390 - $_abbr_i18n_save = $this->languageStd;  
391 - $_mnt_language = $_POST['mnt_language'];  
392 - $_lang_code_selected = $_POST['mnt_code_selected'];  
393 - $_lang_data_selected[$_lang_code_selected] = ($_POST['mnt_lang_data'][$_lang_code_selected]);  
394 -  
395 - // Variaveis para o Template  
396 -  
397 - // fim de variaveis para o template  
398 -  
399 - // inicio de Montagem pagina HTML  
400 - $_objTmpl->readTemplatesFromInput( 'translate_mnt_tmpl.html' );  
401 - $_objTmpl->addVar( 'ini_page_form', 'classSelfPath', $this->classSelfPath );  
402 - $_objTmpl->addVar( 'ini_page_form', 'TRANSLATOR_URL_PATH', $this->translatorUrlPath );  
403 -  
404 - // Se acionado o botao para traduzir, retira-o e mostra o SALVAR/RESTAURAR  
405 - if($_translate_only) {  
406 - $_objTmpl->addVar( 'ini_page_form_btn', 'mnt_btn_show',"translate");  
407 - }  
408 - if(isset($_POST['save_translation'])) {  
409 - $this->_langSave($_POST['lang_target'],$this->languageUser);  
410 - }  
411 -  
412 - if(defined( '_VALID_MOS' ))  
413 - $_objTmpl->addVar( 'ini_page_form_mos', 'mos_page',"inside");  
414 -  
415 - if($_langAction == 'excluir' ) {  
416 - $this->_langCodeDelete($_lang_data_selected);  
417 - $_list_lang = true;  
418 - $this->_langSave($this->translatedTextStd,$_abbr_i18n_save);  
419 - }  
420 -  
421 - if($_langAction == 'salvar') {  
422 - $_list_lang = true;  
423 - $this->translatedTextStd[$this->stripContraBarra($_mnt_language['code'])] = $_mnt_language;  
424 - $this->_langSave($this->translatedTextStd,$_abbr_i18n_save);  
425 - }  
426 -  
427 - // (re)constroi os arrays para o template  
428 - if(!empty($_POST['tag_active']))  
429 - $this->languageSectionActive = $_POST['tag_active'];  
430 -  
431 - $this->initStdLanguages();  
432 - $this->buildArrayVars();  
433 -  
434 - $titulo = $this->getText('#phpTranslator_page_title#');  
435 - $_objTmpl->addVar( 'ini_page_form', 'titulo', $titulo );  
436 - $_objTmpl->addVar( 'ini_page_form', 'PHPTRANSLATOR_EXCLUIR_CODIGO',  
437 - $this->getText('#phpTranslator_excluir codigo#') );  
438 - $_objTmpl->displayParsedTemplate('ini_page_form');  
439 - $this->showTagHeader(&$_objTmpl);  
440 -  
441 - $_objTmpl->addVar( 'ini_page_form_btn', 'BTN_INSERIR',  
442 - $this->getText('#phptranslator_inserir#') );  
443 - $_objTmpl->addVar( 'ini_page_form_btn', 'BTN_ALTERAR',  
444 - $this->getText('#phptranslator_alterar#') );  
445 - $_objTmpl->addVar( 'ini_page_form_btn', 'BTN_EXCLUIR',  
446 - $this->getText('#phptranslator_excluir#') );  
447 - $_objTmpl->addVar( 'ini_page_form_btn', 'BTN_LISTAR',  
448 - $this->getText('#phptranslator_listar#') );  
449 - $_objTmpl->addVar( 'ini_page_form_btn', 'BTN_TRADUZIR',  
450 - $this->getText('#phptranslator_traduzir#') );  
451 - $_objTmpl->addVar( 'ini_page_form_btn', 'BTN_SALVAR',  
452 - $this->getText('#phptranslator_salvar#') );  
453 - $_objTmpl->addVar( 'ini_page_form_btn', 'BTN_RESTAURAR',  
454 - $this->getText('#phptranslator_restaurar#') );  
455 -  
456 - $_objTmpl->addVar( 'ini_page_form_btn', 'MSG_SELECT_ONE_CHANGE',  
457 - $this->getText('#phptranslator_falta selecionar mensagem a ser alterada#') );  
458 -  
459 - $_objTmpl->addVar( 'ini_page_form_btn', 'MSG_SELECT_ONE_DELETE',  
460 - $this->getText('#phptranslator_falta selecionar mensagem a ser excluida#') );  
461 -  
462 - $_objTmpl->addVar( 'translate_mnt', 'BTN_SALVAR',  
463 - $this->getText('#phptranslator_salvar#') );  
464 - $_objTmpl->addVar( 'translate_mnt', 'BTN_RESTAURAR',  
465 - $this->getText('#phptranslator_restaurar#') );  
466 - $_objTmpl->addVar( 'translate_mnt', 'STANDARD_LANG_CODING',  
467 - $this->getText('#phptranslator_codificacao de idioma padrao#') );  
468 - $_objTmpl->addVar( 'translate_mnt', 'STANDARD_LANG_CODING_CONTEXT',  
469 - $this->getText('#phptranslator_contexto da mensagem#') );  
470 - $_objTmpl->addVar( 'translate_mnt', 'STANDARD_LANG_CODING_LANG',  
471 - $this->getText('#phptranslator_idioma#') );  
472 - $_objTmpl->addVar( 'translate_mnt', 'STANDARD_LANG_CODING_MSG_CODE',  
473 - $this->getText('#phptranslator_codigo da mensagem#') );  
474 - $_objTmpl->addVar( 'translate_mnt', 'STANDARD_LANG_CODING_MSG_TYPE',  
475 - $this->getText('#phptranslator_tipo da mensagem#') );  
476 - $_objTmpl->addVar( 'translate_mnt', 'STANDARD_LANG_CODING_MSG_ABBR',  
477 - $this->getText('#phptranslator_sigla para a mensagem#') );  
478 - $_objTmpl->addVar( 'translate_mnt', 'STANDARD_LANG_CODING_MSG',  
479 - $this->getText('#phptranslator_mensagem#') );  
480 - $_objTmpl->addVar( 'translate_mnt', 'STANDARD_LANG_CODING_ADVISE',  
481 - $this->getText('#phptranslator_mnt_code_advise#') );  
482 -  
483 - $_objTmpl->addVar( 'translate_list_head', 'STANDARD_LANG_REPORTING',  
484 - $this->getText('#phptranslator_listagem de mensagens padrao codificadas#') );  
485 -  
486 - $_objTmpl->displayParsedTemplate('form_buttons');  
487 -  
488 - if($_langAction == 'inserir' or $_langAction == 'alterar') {  
489 -  
490 - $_show_form = true;  
491 -  
492 - $_objTmpl->addVar( 'translate_mnt',"LANG_COUNTRY_LEN", $this->messageCountryLen);  
493 - $_objTmpl->addVar( 'translate_mnt',"LANG_CODE_LEN", $this->messageCodeLen );  
494 - $_objTmpl->addVar( 'translate_mnt',"LANG_CONTEXT_LEN",$this->messageContextLen);  
495 - $_objTmpl->addVar( 'translate_mnt',"LANG_TYPE_LEN", $this->messageTypeLen);  
496 - $_objTmpl->addVar( 'translate_mnt',"LANG_ABBR_LEN", $this->messageAbbrLen);  
497 -  
498 - if(array_key_exists('alterar', $_POST['mnt_lang_action']) ) {  
499 - if(empty($_lang_code_selected))  
500 - $_show_form = false;  
501 -  
502 - $_objTmpl->addVar( 'translate_mnt',"LANG_COUNTRY", $this->stripContraBarra($_lang_data_selected[$_lang_code_selected]['lang'] ));  
503 - $_objTmpl->addVar( 'translate_mnt',"LANG_CODE_DISABLED", 'disabled' );  
504 - $_objTmpl->addVar( 'translate_mnt',"LANG_CODE", $this->stripContraBarra($_lang_code_selected ));  
505 - $_objTmpl->addVar( 'translate_mnt',"LANG_CONTEXT",  
506 - $this->stripContraBarra($_lang_data_selected[$_lang_code_selected]['context'] ));  
507 - $_objTmpl->addVar( 'translate_mnt',"LANG_TYPE", $this->stripContraBarra($_lang_data_selected[$_lang_code_selected]['type'] ));  
508 - $_objTmpl->addVar( 'translate_mnt',"LANG_ABBR", $this->stripContraBarra($_lang_data_selected[$_lang_code_selected]['abbr'] ));  
509 - $_objTmpl->addVar( 'translate_mnt',"LANG_MESSAGE", $this->stripContraBarra($_lang_data_selected[$_lang_code_selected]['text'] ));  
510 - }  
511 - else {  
512 - $_objTmpl->addVar( 'translate_mnt',"LANG_COUNTRY", $this->languageStd );  
513 - }  
514 -  
515 - if($_show_form)  
516 - $_objTmpl->displayParsedTemplate('translate_mnt');  
517 - $_list_lang = true;  
518 - }  
519 -  
520 - if(!$_translate_only and ($_langAction == 'listar' or $_list_lang)) {  
521 - $_objTmpl->displayParsedTemplate('translate_list_head');  
522 - if($this->arrLanguageList)  
523 - foreach($this->arrLanguageList as $_keys => $_key) {  
524 - $_objTmpl->addVar( 'translate_list_body', 'TAB_CONTEXT', $_keys );  
525 -  
526 - $_objTmpl->addVar( 'translate_list_body', 'STANDARD_LANG_CODING_LANG',  
527 - $this->getText('#phptranslator_idioma#') );  
528 - $_objTmpl->addVar( 'translate_list_body', 'STANDARD_LANG_CODING_MSG_CODE',  
529 - $this->getText('#phptranslator_codigo da mensagem#') );  
530 - $_objTmpl->addVar( 'translate_list_body', 'STANDARD_LANG_CODING_MSG_TYPE',  
531 - $this->getText('#phptranslator_tipo da mensagem#') );  
532 - $_objTmpl->addVar( 'translate_list_body', 'STANDARD_LANG_CODING_MSG_ABBR',  
533 - $this->getText('#phptranslator_sigla para a mensagem#') );  
534 - $_objTmpl->addVar( 'translate_list_body', 'STANDARD_LANG_CODING_MSG',  
535 - $this->getText('#phptranslator_mensagem#') );  
536 -  
537 - $_objTmpl->addRows( 'translate_list_by_context', $this->arrLanguageList[$_keys] );  
538 - $_objTmpl->displayParsedTemplate('translate_list_body');  
539 - // limpa dados de template para acrecentar outros dados  
540 - $_objTmpl->clearTemplate('translate_list_body');  
541 - $_objTmpl->clearTemplate('translate_list_by_context');  
542 - } // end foreach  
543 - else  
544 - $_objTmpl->addVar('translate_list_foot', 'LIST_MESSAGE', $this->getText('#phptranslator_text#')." ".$this->getText('#phptranslator_not found#'));  
545 -  
546 - $_objTmpl->displayParsedTemplate('translate_list_foot');  
547 - }  
548 -  
549 - if($_translate_only or $_langAction == 'tradutor') {  
550 - // inicio de Montagem pagina do tradutor  
551 - $_objTmpl->readTemplatesFromInput( 'translate_tmpl.html' );  
552 - $_objTmpl->addVar( 'translate_lang_head', 'STANDARD_LANG_TRANSLATION',  
553 - $this->getText('#phptranslator_traducao do idioma padrao#') );  
554 -  
555 - $_objTmpl->displayParsedTemplate('translate_lang_head');  
556 - if(is_array($this->arrLanguageLang ))  
557 - foreach($this->arrLanguageLang as $_keys => $_key) {  
558 - $_objTmpl->addVar( 'translate_lang_body', 'STANDARD_TEXT',  
559 - $this->getText('#phptranslator_texto padrao#') );  
560 - $_objTmpl->addVar( 'translate_lang_body', 'TARGET_TEXT',  
561 - $this->getText('#phptranslator_traduzir para#') );  
562 - $_objTmpl->addVar( 'translate_lang_body', 'TRANSLATED_TEXT',  
563 - $this->getText('#phptranslator_texto traduzido#') );  
564 - $_objTmpl->addVar( 'translate_lang_body', 'ABBREVIATION',  
565 - $this->getText('#phptranslator_sigla#')."/".  
566 - $this->getText('#phptranslator_simbolo#') );  
567 - $_objTmpl->addVar( 'translate_lang_body', 'BTN_SALVAR',  
568 - $this->getText('#phptranslator_salvar#') );  
569 - $_objTmpl->addVar( 'translate_lang_body', 'BTN_RESTAURAR',  
570 - $this->getText('#phptranslator_restaurar#') );  
571 -  
572 -  
573 - $_objTmpl->addVar( 'translate_lang_body', 'TAB_CONTEXT', $_keys );  
574 - $_objTmpl->addVar( 'translate_lang_body','LANGUAGE_SOURCE',"(".$this->languageStd.")");  
575 - $_objTmpl->addVar( 'translate_lang_body','LANGUAGE_TARGET',"(".$this->_getLanguage().")");  
576 - $_objTmpl->addRows( 'translate_lang_list_entry', $this->arrLanguageLang[$_keys] );  
577 - $_objTmpl->displayParsedTemplate('translate_lang_body');  
578 - // limpa dados de template para acrecentar outros dados  
579 - $_objTmpl->clearTemplate('translate_lang_body');  
580 - $_objTmpl->clearTemplate('translate_lang_list_entry');  
581 - } // end foreach  
582 -  
583 - $_objTmpl->displayParsedTemplate('translate_lang_foot');  
584 - // fim de Montagem pagina do tradutor  
585 - }  
586 - $_objTmpl->displayParsedTemplate('end_page_form');  
587 -  
588 - } //end func: Translate  
589 -  
590 - /**  
591 - * Busca o texto a ser traduzido  
592 - *  
593 - * @access public  
594 - * @see getText()  
595 - * @return string O texto traduzido, o texto padrao ou o codigo da mensagem  
596 - *  
597 - */  
598 - function _( $_msg_code, $_sigla=false, $_text_case=0, $_args = array() ) {  
599 - return $this->getText( $_msg_code, $_sigla, $_text_case, $_args );  
600 - }  
601 -  
602 - /**  
603 - * Busca o texto a ser traduzido  
604 - *  
605 - * Busca a traducao do texto - caso o texto traduzido nao exista retorna o texto padrao e caso este  
606 - * tambem nao exista retorna o codigo de pesquisa  
607 - *  
608 - * @access public  
609 - * @param string $_msg_code O codigo da mensagem a ser traduzida  
610 - * @param boolean $_sigla Se retorna a sigla em lugar da mensagem completa  
611 - * @param boolean $_text_case Se o texto retorna o texto como cadastrado, em maiusculas ou minusculas  
612 - * 1 - maiuscula  
613 - * 2 - minuscula  
614 - * outro - como estiver cadastrado  
615 - *  
616 - * @return string O texto traduzido, o texto padrao ou o codigo da mensagem  
617 - *  
618 - */  
619 - function getText( $_msg_code, $_sigla=false, $_text_case=0, $_args = array() ) {  
620 -  
621 - if(is_array($_sigla)) {  
622 - $_args = $_sigla;  
623 - $_sigla = false;  
624 - }  
625 - if(is_array($_text_case)) {  
626 - $_args = $_text_case;  
627 - $_text_case = 0;  
628 - }  
629 - if(!is_bool($_sigla)) $_sigla = false;  
630 -  
631 - if(!empty($_msg_code) && ($this->translateMessage)) {  
632 - $_msg_text = $this->_getStdText( &$_msg_code, &$_sigla, &$_text_case, &$_args);  
633 - }  
634 - else {  
635 - $_msg_text = $_msg_code;  
636 - }  
637 -  
638 - return $_msg_text;  
639 -  
640 - } // end func: getText  
641 -  
642 - /**  
643 - * Metodo para retornar a mensagens de erros ocorridas  
644 - *  
645 - * @access public  
646 - * @name getMessage  
647 - */  
648 - function getMessage() {  
649 - return $this->mensagem;  
650 - } // end func: getMessage  
651 -  
652 - /**  
653 - * Metodo para retornar se houve erro ou nao na classe  
654 - *  
655 - * @access public  
656 - * @return boolean TRUE - houve erro ao processar a classe  
657 - * FALSE - nao houve erro  
658 - */  
659 - function isError() {  
660 - return $this->error;  
661 - } // end func: isError  
662 -  
663 - /**  
664 - * Atribui o caminho fisico para os arquivos de idiomas  
665 - *  
666 - * devera conter as secoes dos arquivos de idiomas, conforme contextualizacao  
667 - * <code>  
668 - * ...  
669 - * $_lang_sections = array(  
670 - * 'phpTranslator' => 'textos da classe de traducao',  
671 - * 'admin' => 'Textos da secao administrativa',  
672 - * 'home' => 'textos da secao principal',  
673 - * 'and son on' => 'e assim por diante...');  
674 - *  
675 - * $objTranslator->setLangFileSections($_lang_sections);  
676 - * ...  
677 - * </code>  
678 - * @param string $_languageFilePath O caminho para os arquivos de idiomas  
679 - * @var array  
680 - * @since v 0.2.0-40  
681 - */  
682 - function setLangFileSections($_languageSections=array()) {  
683 - if(empty($_languageSections)) {  
684 - $this->message = "Impossivel processar traducao por secoes, secoes nao informadas.";  
685 - $this->error = true;  
686 - }  
687 - else {  
688 - $this->languageSections = $_languageSections;  
689 - $this->error = false;  
690 - }  
691 - return !$this->error;  
692 - }  
693 -  
694 - /**  
695 - * Atribui o caminho fisico para os arquivos de idiomas  
696 - *  
697 - * @param string $_languageFilePath O caminho para os arquivos de idiomas  
698 - */  
699 - function setLangFilePath($_languageFilePath="") {  
700 - if (!empty($_languageFilePath))  
701 - $this->languageFilePath = $_languageFilePath;  
702 - } // end func: setLangFilePath  
703 -  
704 - /**  
705 - * Mostra o formulario de selecao de contextos  
706 - * @access private  
707 - * @since v 0.2.0-40  
708 - */  
709 - function showTagHeader(&$_objTmpl) {  
710 - if ($this->languageFileInSections)  
711 - if(!is_object($_objTmpl)) {  
712 - $this->mensagem = $this->getText('#phptranslator_objTemplate#').$this->getText('#phptranslator_not found#');  
713 - if($this->inDebugMode() ) echo "phpTranslator: ".$this->getMessage();  
714 - $this->error = true;  
715 - }  
716 - else {  
717 - if(is_array($this->languageSections) and !empty($this->languageSections)) {  
718 - $_list = array();  
719 - foreach($this->languageSections as $_tag => $_tag_title) {  
720 - $_tag_current = '';  
721 - if($_tag == $this->languageSectionActive)  
722 - $_tag_current = 'TagCurrent';  
723 -  
724 - $_arrAux = array(  
725 - array(  
726 - 'TAG_NAME' => $_tag,  
727 - 'TAG_HEADER_ACTIVE' => $_tag_current,  
728 - 'TAG_HEADER' => $this->getText($_tag),  
729 - 'TAG_HEADER_TITLE' => $this->getText($_tag_title)  
730 - )  
731 - );  
732 - $_list = array_merge($_list,$_arrAux);  
733 - }  
734 - /*  
735 - echo $this->languageSectionActive;  
736 - if('tradutor' == $this->languageSectionActive)  
737 - $_tag_current = 'TagCurrent';  
738 -  
739 - $_list = array_merge($_list,  
740 - array(  
741 - array(  
742 - 'TAG_NAME' => 'tradutor',  
743 - 'TAG_HEADER_ACTIVE' => $_tag_current,  
744 - 'TAG_HEADER' => $this->getText('tradutor'),  
745 - 'TAG_HEADER_TITLE' => $this->getText('Classe Tradutora')  
746 - )  
747 - )  
748 - );  
749 - */  
750 - $_objTmpl->addRows( 'tmplTagHeader_list', $_list);  
751 - $_objTmpl->addVar('tmplTagHeader','translatorUrlPath',$this->translatorUrlPath);  
752 - $_objTmpl->addVar('tmplTagHeader','TAG_ACTIVE',$_POST['tag_active']);  
753 - $_objTmpl->displayParsedTemplate('tmplTagHeader');  
754 - }  
755 - else {  
756 - $this->mensagem = $this->getText('#phptranslator_section array not defined#');  
757 - if($this->inDebugMode() ) echo "phpTranslator: ".$this->getMessage();  
758 - $this->error = true;  
759 - }  
760 - }  
761 - } // end func: showTagHeader  
762 -  
763 - /**  
764 - * Atribui o caminho (URL) para a classe  
765 - *  
766 - * @param string $_translatorUrlPath A URL para a classe  
767 - * @since v 0.2.0-40  
768 - */  
769 - function setURLPath($_translatorUrlPath="") {  
770 - if (!empty($_translatorUrlPath))  
771 - $this->translatorUrlPath = $_translatorUrlPath;  
772 - } // end func: setURLPath  
773 -  
774 - /**  
775 - * Atribui o sufixo para o arquivo de idiomas  
776 - *  
777 - * @param string $_file_sufix O sufixo a ser atribuido ao arquivo  
778 - */  
779 - function setLangFileSufix($_file_sufix="") {  
780 - if (!empty($_file_sufix))  
781 - $this->languageFileSufix = $_file_sufix;  
782 - } // end func: setLangFileSufix  
783 -  
784 - /**  
785 - * Atribui o prefixo para o arquivo de idiomas  
786 - *  
787 - * @param string $_file_prefix O prefixo a ser atribuido ao arquivo  
788 - */  
789 - function setLangFilePrefix($_file_prefix="") {  
790 - if (!empty($_file_prefix))  
791 - $this->languageFilePrefix = $_file_prefix;  
792 - } // end func: setLangFilePrefix  
793 -  
794 - /**  
795 - * Atribui os idiomas a serem usado na aplicacao  
796 - *  
797 - * @access private  
798 - * @param string $_abbr_i18n ISO do Idioma em questao  
799 - * @param string $_lang_choice Qual o padrao a ser lido e armazenado  
800 - * standard - o padrao para a aplicacao  
801 - * target - o idioma destino  
802 - * user - o idioma para o usuario  
803 - */  
804 - function setLanguage($_abbr_i18n, $_lang_choice='standard') {  
805 - switch ($_lang_choice) {  
806 - case 'standard': {  
807 - $this->setLangSrc($_abbr_i18n);  
808 - break;  
809 - }  
810 - case 'target': {  
811 - $this->setLangTgt($_abbr_i18n);  
812 - break;  
813 - }  
814 - case 'user': {  
815 - $this->setLangUser($_abbr_i18n);  
816 - break;  
817 - }  
818 - }  
819 - } // end func: setLanguage  
820 -  
821 -  
822 - /**  
823 - * Inicializa os arrays de idiomas especificos (padrao ou destino)  
824 - * @access public  
825 - */  
826 - function initStdLanguages() {  
827 - $this->buildLangArray();  
828 - $this->buildLangArray('target');  
829 - }  
830 -  
831 - /**  
832 - * Le os arquivos de idioma e os armazena em array especificos (padrao ou destino)  
833 - * @access private  
834 - * @param string $_lang_choice Qual o padrao a ser lido e armazenado<br>  
835 - * . standard - o padrao para a aplicacao<br>  
836 - * . target - o idioma a ser mostrado para o usuario<br>  
837 - */  
838 - function buildLangArray($_lang_choice='standard') {  
839 - switch ($_lang_choice) {  
840 - case 'standard': {  
841 - $this->translatedTextStd = $this->_getLangFile();  
842 - $this->translated_text[$this->languageStd] = $this->translatedTextStd;  
843 - break;  
844 - }  
845 - case 'target': {  
846 - $this->translatedTextTgt = $this->_getLangFile($this->languageUser);  
847 - $this->translated_text[$this->languageUser] = $this->translatedTextTgt;  
848 - break;  
849 - }  
850 - }  
851 - } // end func: buildLangArray  
852 -  
853 - /**  
854 - * Constroi o array de traducao de idiomas (DE -> PARA)  
855 - *  
856 - * @access private  
857 - */  
858 - function getLangArray4Translate() {  
859 -  
860 - $_language_src = $this->translatedTextStd;  
861 - $_language_tgt = $this->translatedTextTgt;  
862 -  
863 - if($_language_src) {  
864 - //Idioma a traduzir  
865 - // cria array para cada context  
866 - foreach($_language_src as $_keys => $_key) {  
867 - if($_key['type'] != 'notran')  
868 - $_list[$this->getText($_key['context'])] = array();  
869 - } // end foreach  
870 -  
871 - foreach($_language_src as $_keys => $_key) {  
872 - if(!empty($_language_tgt[$_keys]['text']) or !empty($_language_tgt[$_keys]['abbr']))  
873 - $_cor = "";  
874 - else  
875 - $_cor = T_BG_COLOR_TRADUZ;  
876 -  
877 - if($_key['type'] != 'notran')  
878 - $_arrAux = array(  
879 - array( 'cor' => $_cor,  
880 - 'lang_src_key' => $_keys,  
881 - 'lang_language' => $this->languageUser,  
882 - 'lang_context' => $_key['context'],  
883 - 'lang_type' => $_key['type'],  
884 - 'lang_src' => $_key['text'],  
885 - 'lang_tgt' => $_language_tgt[$_keys]['text'],  
886 - 'lang_tgt_acr' => $_language_tgt[$_keys]['abbr']  
887 - )  
888 - );  
889 -  
890 - //$_list = array_merge($_list, $_arrAux);  
891 - $_list[$this->getText($_key['context'])] = array_merge($_list[$this->getText($_key['context'])],$_arrAux);  
892 - } // end foreach  
893 - }  
894 -  
895 - if(empty($_list))  
896 - $_list = false;  
897 -  
898 - return $_list;  
899 - } // end Function getLangArray4Translate  
900 -  
901 - /**  
902 - * Constroi o array de listagem de idioma padrao  
903 - *  
904 - * @access private  
905 - */  
906 - function getLangArray4List() {  
907 - $_language_src = $this->translatedTextStd;  
908 - //Idioma a traduzir  
909 - if(!empty($_language_src)) {  
910 - // cria array para cada context  
911 - foreach($_language_src as $_keys => $_key) {  
912 - if($_key['type'] != 'notran')  
913 - $_list[$this->getText($_key['context'])] = array();  
914 - } // end foreach  
915 -  
916 - foreach($_language_src as $_keys => $_key) {  
917 - if($_key['type'] != 'notran') {  
918 - $_arrAux = array(  
919 - array(  
920 - 'list_lang' => $this->languageStd,  
921 - 'list_lang_code' => $_keys,  
922 - 'list_lang_context' => $_key['context'],  
923 - 'list_lang_type' => $_key['type'],  
924 - 'list_lang_message' => $_key['text'],  
925 - 'list_lang_abbr' => $_language_src[$_keys]['abbr']  
926 - )  
927 - );  
928 -  
929 - $_list[$this->getText($_key['context'])] = array_merge($_list[$this->getText($_key['context'])],$_arrAux);  
930 - }  
931 - } // end foreach  
932 - }  
933 - if(empty($_list))  
934 - $_list = false;  
935 -  
936 - return $_list;  
937 - } // end Function getLangArray4List  
938 -  
939 - /**  
940 - * Constroi os arrays de traducao e listagem de idioma padrao  
941 - *  
942 - * @access private  
943 - */  
944 - function buildArrayVars() {  
945 - $this->arrLanguageLang = $this->getLangArray4Translate();  
946 - $this->arrLanguageList = $this->getLangArray4List();  
947 - if(!empty($this->arrLanguageLang))  
948 - ksort($this->arrLanguageLang);  
949 - if(!empty($this->arrLanguageList))  
950 - ksort($this->arrLanguageList);  
951 - } // end Function buildArrayVars  
952 -  
953 - /**  
954 - * Constroi string de conteudo do arquivo a ser salvo  
955 - *  
956 - * @access private  
957 - * @param array $_lang_tgt_text_file Idioma a ser salvo  
958 - */  
959 - function buildStr4File($_lang_tgt_text_file) {  
960 - $_new_target_file = "";  
961 - if(is_array($_lang_tgt_text_file)) {  
962 - foreach($_lang_tgt_text_file as $_keys => $_values) {  
963 - $_text_test = $this->stripContraBarra(trim($_values['text'] ). trim($_values['abbr']));  
964 - $_keyCode = $this->stripContraBarra($_values['code']);  
965 - if( ! $_keyCode ) $_keyCode = $this->stripContraBarra($_keys);  
966 - if(!empty($_text_test)) {  
967 - $_new_target_file .= $this->stripContraBarra($_values['lang']).  
968 - $this->_spaces($this->messageCountryLen-  
969 - strlen($this->stripContraBarra($_values['lang'])));  
970 - $_new_target_file .= $_keyCode.  
971 - $this->_spaces($this->messageCodeLen-strlen($_keyCode));  
972 -  
973 - $_new_target_file .= $this->stripContraBarra($_values['context']).  
974 - $this->_spaces($this->messageContextLen-  
975 - strlen($this->stripContraBarra($_values['context'])));  
976 - $_new_target_file .= $this->stripContraBarra($_values['type']).  
977 - $this->_spaces($this->messageTypeLen-  
978 - strlen($this->stripContraBarra($_values['type'])));  
979 - $_new_target_file .= $this->stripContraBarra($_values['abbr']).  
980 - $this->_spaces($this->messageAbbrLen-  
981 - strlen($this->stripContraBarra($_values['abbr'])));  
982 - $_new_target_file .= $this->stripContraBarra($_values['text']);  
983 - $_new_target_file .= T_CRLF ;  
984 - }  
985 - }  
986 - }  
987 - else {  
988 - $this->Error = true;  
989 - $this->mensagem = $this->getText('#phptranslator_array parameter required#');  
990 - if($this->inDebugMode() ) echo "phpTranslator: ".$this->getMessage();  
991 - $_new_target_file = false;  
992 - }  
993 -  
994 - return $_new_target_file;  
995 - } // end Function buildStr4File  
996 -  
997 - /**  
998 - * Salva o arquivo de idioma conforme definido nos padroes  
999 - *  
1000 - * @access private  
1001 - * @param string $_content_to_file Texto/conteudo do arquivo a ser salvo  
1002 - * @param string $_abbr_i18n Idioma do arquivo a ser salvo- se nao informado busca o idioma padrao  
1003 - * @param boolean $_file_increment Se o conteudo do arquivo sera incrementado - padrao eh sobrescrever  
1004 - * @return boolean se o arquivo foi salvo ou nao  
1005 - */  
1006 - function saveLangFile($_content_to_file, $_abbr_i18n = "", $_file_increment=false) {  
1007 -  
1008 - if(empty($_abbr_i18n))  
1009 - $_abbr_i18n = $this->languageStd;  
1010 -  
1011 - $_file_name = $this->_makeFileName($_abbr_i18n);  
1012 -  
1013 - $this->error = true;  
1014 - $this->mensagem = "";  
1015 -  
1016 - if(is_writable($this->languageFilePath)) {  
1017 - if (is_writable($_file_name) or !file_exists($_file_name)) {  
1018 - if(($_file_increment) and file_exists($_file_name))  
1019 - $_resource = @fopen($_file_name,'w+');  
1020 - else  
1021 - $_resource = @fopen($_file_name,'w');  
1022 -  
1023 - if($_resource){  
1024 - fwrite($_resource,$_content_to_file);  
1025 - fclose($_resource);  
1026 - }  
1027 - else {  
1028 - $this->mensagem = $this->getText('#phptranslator_file#')." ($_file_name) ".$this->getText('#phptranslator_without write permition#');  
1029 - if($this->inDebugMode() ) echo "phpTranslator: ".$this->getMessage();  
1030 - $this->error = false;  
1031 - }  
1032 - }  
1033 - else {  
1034 - $this->mensagem = $this->getText('#phptranslator_file#')." ($_file_name) ".$this->getText('#phptranslator_without write permition#');  
1035 - if($this->inDebugMode() ) echo "phpTranslator: ".$this->getMessage();  
1036 - $this->error = false;  
1037 - }  
1038 - }  
1039 - else {  
1040 - $this->mensagem = $this->getText('#phptranslator_directory#')." ($this->languageFilePath) ".$this->getText('#phptranslator_without write permition#');  
1041 - if($this->inDebugMode() ) echo "phpTranslator: ".$this->getMessage();  
1042 - $this->error = false;  
1043 - }  
1044 -  
1045 - return $this->error;  
1046 - } // end func: SaveFile  
1047 -  
1048 - /*  
1049 - * Metodos PRIVATE  
1050 - */  
1051 -  
1052 - /**  
1053 - * Atribui o idioma padrao para a aplicacao  
1054 - *  
1055 - * @access private  
1056 - * @param string $_abbr_i18n ISO do Idioma da aplicacao  
1057 - */  
1058 - function setLangSrc($_abbr_i18n) {  
1059 - $this->languageStd = $_abbr_i18n;  
1060 - } // end func: setLangSrc  
1061 -  
1062 - /**  
1063 - * Atribui o idioma do usuario  
1064 - *  
1065 - * @access private  
1066 - * @param string $_abbr_i18n ISO do Idioma do usuario  
1067 - */  
1068 - function setLangUser($_abbr_i18n) {  
1069 - $this->languageUser = $_abbr_i18n;  
1070 - } // end func: setLangUser  
1071 -  
1072 - /**  
1073 - * Atribui o idioma do destino na traducao  
1074 - *  
1075 - * @access private  
1076 - * @param string $_abbr_i18n ISO do Idioma target  
1077 - */  
1078 - function setLangTgt($_abbr_i18n) {  
1079 - $this->setLangUser($_abbr_i18n) ;  
1080 - } // end func: setLangTgt  
1081 -  
1082 - /**  
1083 - * Monta o nome do arquivo de idiomas  
1084 - * @access private  
1085 - *  
1086 - * @param string $_abbr_i18n Codigo ISO do idioma a ser usado  
1087 - *  
1088 - * @return string O nome do arquivo (incluindo o path)  
1089 - */  
1090 - function _makeFileName($_abbr_i18n) {  
1091 - if(empty($_abbr_i18n))  
1092 - $_abbr_i18n = $this->languageUser;  
1093 -  
1094 - $_file_name = $this->languageFilePath;  
1095 - if($this->languageFilesubdir)  
1096 - $_file_name .= $_abbr_i18n."/";  
1097 -  
1098 - $_file_name .= $this->languageFilePrefix;  
1099 - if ($this->languageFileInSections)  
1100 - if(!empty($this->languageSectionActive))  
1101 - $_file_name .= $this->languageSectionActive.".";  
1102 -  
1103 - $_file_name .= $_abbr_i18n;  
1104 - $_file_name .= $this->languageFileSufix;  
1105 - $this->error = false;  
1106 -  
1107 - if(!is_file($_file_name)) {  
1108 - $this->mensagem = $this->getText('#phptranslator_file#')." ($_file_name) ".$this->getText('#phptranslator_not found#');  
1109 - if($this->inDebugMode() ) echo "phpTranslator: ".$this->getMessage();  
1110 - $this->error = true;  
1111 - }  
1112 -  
1113 - return $_file_name;  
1114 -  
1115 - } // end func: MakeFileName  
1116 -  
1117 - /**  
1118 - * Monta o nome do arquivo de idiomas  
1119 - * @access private  
1120 - *  
1121 - * @param string $_abbr_i18n Codigo ISO do idioma a ser usado  
1122 - *  
1123 - * @return string O nome do arquivo (incluindo o path)  
1124 - */  
1125 - function _getExternalFile($_filename, $_abbr_i18n) {  
1126 - $_file_content = "";  
1127 - $_file_name = $this->languageFilePath;  
1128 - if($this->languageFilesubdir)  
1129 - $_file_name .= $_abbr_i18n.DIRECTORY_SEPARATOR;  
1130 - $_file_name .= $_filename;  
1131 -  
1132 - $this->error = false;  
1133 -  
1134 - if(!is_file($_file_name) and !is_readable($_file_name)) {  
1135 - $this->mensagem = $this->getText('#phptranslator_file#')." ($_file_name) ".$this->getText('#phptranslator_not found#');  
1136 - $_file_content = $this->mensagem;  
1137 - if($this->inDebugMode() ) echo "phpTranslator: ".$this->getMessage();  
1138 - $this->error = true;  
1139 - }  
1140 - else {  
1141 - $_file_content = file_get_contents($_file_name);  
1142 - }  
1143 -  
1144 - return $_file_content;  
1145 -  
1146 - } // end func: getExternalFile  
1147 -  
1148 - /**  
1149 - * Idioma a ser traduzido para a aplicacao.  
1150 - * Se o preferido pelo usuario ou o do Browser em uso ou o padrao da aplicacao  
1151 - * @access private  
1152 - */  
1153 - function _getLanguage() {  
1154 -  
1155 - // faz insercao dos textos padroes para a aplicacao (conforme o idioma  
1156 - $_language = "";  
1157 - if(!empty($this->languageUser))  
1158 - $_language = $this->languageUser;  
1159 - elseif(!empty($this->_browserLanguage))  
1160 - $_language = $this->_browserLanguage;  
1161 - else  
1162 - $_language = $this->languageStd;  
1163 -  
1164 - return $_language;  
1165 - } // end func: _getLanguage  
1166 -  
1167 - /**  
1168 - * Busca o texto a ser traduzido dentro do array de idiomas  
1169 - *  
1170 - * Busca a traducao do texto - caso o texto traduzido nao exista retorna o texto padrao e caso este  
1171 - * tambem nao exista retorna o codigo de pesquisa  
1172 - *  
1173 - * @access private  
1174 - * @param string $_msg_code O codigo da mensagem a ser traduzida  
1175 - * @param boolean $_sigla Se retorna a sigla em lugar da mensagem completa  
1176 - * @param boolean $_text_case Se o texto retorna o texto como cadastrado, em maiusculas ou minusculas  
1177 - * 1 - maiuscula  
1178 - * 2 - minuscula  
1179 - * outro - como estiver cadastrado  
1180 - * @param array $_args Sao os argumentos nessarios para substituir no texto que contenha %n  
1181 - *  
1182 - * @return string O texto traduzido, o texto padrao ou o codigo da mensagem  
1183 - *  
1184 - */  
1185 - function _getStdText( $_msg_code='', $_sigla=false, $_text_case=0, $_args = array() ) {  
1186 - if(!empty($_msg_code))  
1187 - /*  
1188 - * - A chave de procura deve estar em minusculas bem como o conteudo do arquivo de idiomas  
1189 - */  
1190 - $_key_lower_text = strtolower($_msg_code);  
1191 -  
1192 - $_lang_array_aux = $this->translated_text[$this->_getLanguage()];  
1193 - if(@array_key_exists($_key_lower_text, $_lang_array_aux)) {  
1194 - if(@array_key_exists('type', $_lang_array_aux[$_key_lower_text]) and  
1195 - ($_lang_array_aux[$_key_lower_text]['type'] == 'arquivo' or  
1196 - $_lang_array_aux[$_key_lower_text]['type'] == 'file' ) )  
1197 - {  
1198 - if(@array_key_exists('text', $_lang_array_aux[$_key_lower_text])) {  
1199 - $_file_name = $_lang_array_aux[$_key_lower_text]['text'];  
1200 - $_msg_code_aux = $this->_getExternalFile($_file_name, $this->languageUser);  
1201 - }  
1202 - }  
1203 - elseif(@array_key_exists('text', $_lang_array_aux[$_key_lower_text])) {  
1204 - $_msg_code_aux = $_lang_array_aux[$_key_lower_text]['text'];  
1205 - if($_sigla)  
1206 - if(@array_key_exists('abbr', $_lang_array_aux[$_key_lower_text]))  
1207 - $_msg_code_aux = $_lang_array_aux[$_key_lower_text]['abbr'];  
1208 - }  
1209 - }  
1210 - else {  
1211 - $_lang_array_aux = $this->translatedTextStd;  
1212 - if(@array_key_exists($_key_lower_text, $_lang_array_aux)) {  
1213 - if(@array_key_exists('type', $_lang_array_aux[$_key_lower_text]) and  
1214 - ($_lang_array_aux[$_key_lower_text]['type'] == 'arquivo' or  
1215 - $_lang_array_aux[$_key_lower_text]['type'] == 'file' ) )  
1216 - {  
1217 - if(@array_key_exists('text', $_lang_array_aux[$_key_lower_text])) {  
1218 - $_file_name = $_lang_array_aux[$_key_lower_text]['text'];  
1219 - $_msg_code_aux = $this->_getExternalFile($_file_name, $this->languageStd);  
1220 - }  
1221 - }  
1222 - elseif(@array_key_exists('text', $_lang_array_aux[$_key_lower_text])) {  
1223 - $_msg_code_aux = $_lang_array_aux[$_key_lower_text]['text'];  
1224 - if($_sigla)  
1225 - if(@array_key_exists('abbr', $_lang_array_aux[$_key_lower_text]))  
1226 - $_msg_code_aux = $_lang_array_aux[$_key_lower_text]['abbr'];  
1227 - }  
1228 - }  
1229 - else {  
1230 - $_lang_array_aux = $this->translatedTextSelf;  
1231 - if(@array_key_exists($_key_lower_text, $_lang_array_aux)) {  
1232 - if(@array_key_exists('text', $_lang_array_aux[$_key_lower_text])) {  
1233 - $_msg_code_aux = $_lang_array_aux[$_key_lower_text]['text'];  
1234 - if($_sigla)  
1235 - if(@array_key_exists('abbr', $_lang_array_aux[$_key_lower_text]))  
1236 - $_msg_code_aux = $_lang_array_aux[$_key_lower_text]['abbr'];  
1237 - }  
1238 - }  
1239 - }  
1240 - }  
1241 -  
1242 - switch ($_text_case) {  
1243 - case 1: // tudo em minusculas  
1244 - $_msg_code_aux = strtolower($_msg_code_aux);  
1245 - break;  
1246 - case 2: // tudo em maiusculas  
1247 - $_msg_code_aux = strtoupper($_msg_code_aux);  
1248 - break;  
1249 - }  
1250 -  
1251 - if(empty($_msg_code_aux))  
1252 - $_msg_code_aux = $_msg_code;  
1253 -  
1254 - $_argcPercentage = substr_count( $_msg_code_aux, "%" );  
1255 - if( $_argcPercentage > 0 ) { // tem % no texto  
1256 - // substitui os %n do texto pelos parametros do array de argumentos  
1257 - for( $i=0; $i<$_argcPercentage; $i++ ) {  
1258 - $_argsValue = "%".($i+1);  
1259 - if( strpos( $_msg_code_aux, $_argsValue ) <> 0 ) {  
1260 - $_msg_code_aux = str_replace($_argsValue, $_args[$i], $_msg_code_aux );  
1261 - }  
1262 - }  
1263 - }  
1264 -  
1265 - return $_msg_code_aux;  
1266 - } // end func: _getStdText  
1267 -  
1268 - /**  
1269 - * Monta uma string contendo espacos em branco  
1270 - * @access private  
1271 - * @param int $_num Numero de espacos que a string contera  
1272 - * @return string Espacos em branco  
1273 - */  
1274 - function _spaces($_num=0) {  
1275 - if($_num>0)  
1276 - for($_inc=1;$_inc<=$_num;$_inc++) {  
1277 - $_spaces .= " ";  
1278 - }  
1279 - return $_spaces;  
1280 - } // end func: _spaces  
1281 -  
1282 - /**  
1283 - * cria template para a propria classe usar  
1284 - * @access private  
1285 - * @return patTemplate  
1286 - */  
1287 - function &_createTemplate() {  
1288 - global $option, $mosConfig_absolute_path;  
1289 -  
1290 - if(defined( '_VALID_MOS' )) {  
1291 - require_once($mosConfig_absolute_path.'/includes/patTemplate/patTemplate.php' );  
1292 - $tmpl =& patFactory::createTemplate();  
1293 - $tmpl->setRoot( dirname( __FILE__ ) . '/templates' );  
1294 - }  
1295 - else {  
1296 - require_once( $this->classSelfPath.'/classes/pat/patErrorManager.php' );  
1297 - require_once( $this->classSelfPath.'/classes/pat/patTemplate.php' );  
1298 - $tmpl = new patTemplate();  
1299 - $tmpl->setNamespace("mos");  
1300 - }  
1301 - $this->_objTmpl = $tmpl;  
1302 - return $tmpl;  
1303 - } // end func: _createTemplate  
1304 -  
1305 -  
1306 - /**  
1307 - * Salvar dados apos alteracoes ou exclusoes de mensagens codificadas  
1308 - *  
1309 - * @access private  
1310 - */  
1311 - function _langSave($_lang_target,$_abbr_i18n_save) {  
1312 - $_text4file = $this->buildStr4File($_lang_target);  
1313 - if(!is_bool($_text4file)) {  
1314 - $_saved = $this->saveLangFile($_text4file,$_abbr_i18n_save);  
1315 - if(!$_saved)  
1316 - if($this->inDebugMode() ) echo $this->getMessage();  
1317 - }  
1318 - elseif(!($_text4file))  
1319 - if($this->inDebugMode() ) echo $this->getMessage();  
1320 - } // end func: _langSave  
1321 -  
1322 - /**  
1323 - * Excluir mensagem do idioma padrao  
1324 - *  
1325 - * @access private  
1326 - * @param array $_lang_data_selected Dado do idioma padrao a ser excluido  
1327 - *  
1328 - */  
1329 - function _langCodeDelete($_lang_data_selected) {  
1330 - foreach($_lang_data_selected as $_keys => $_key) {  
1331 - unset( $this->translatedTextStd[$this->stripContraBarra($_keys)]);  
1332 - }  
1333 - } // end func: _langCodeDelete  
1334 -  
1335 - /**  
1336 - * Busca o arquivo de idiomas  
1337 - *  
1338 - * @access private  
1339 - * @param string $_abbr_i18n O codigo ISO do idioma a ser tratado  
1340 - *  
1341 - * @return array Contem os dados do idioma  
1342 - */  
1343 - function _getLangFile($_abbr_i18n="") {  
1344 -  
1345 - $this->error = false;  
1346 -  
1347 - if(empty($_abbr_i18n))  
1348 - $_abbr_i18n = $this->languageStd;  
1349 -  
1350 - $_src_file_name = $this->_makeFileName($_abbr_i18n);  
1351 -  
1352 - if(!file_exists($_src_file_name)) {  
1353 - $this->mensagem = $this->getText('#phptranslator_language file#')." ($_src_file_name) ".  
1354 - $this->getText('#phptranslator_not found#');  
1355 - if($this->inDebugMode() ) echo "phpTranslator: ".$this->getMessage();  
1356 - $this->error = true;  
1357 - return false;  
1358 - }  
1359 -  
1360 - $_src_file = file($_src_file_name);  
1361 -  
1362 - // monta idioma padrao  
1363 - foreach($_src_file as $_keys => $_values) {  
1364 - $_lang = trim(substr($_values,0,$this->messageCountryLen));  
1365 - $_msg_code = strtolower(trim(substr($_values,$this->messageCountryLen,$this->messageCodeLen)));  
1366 -  
1367 - $_str_start_aux = $this->messageCountryLen+$this->messageCodeLen;  
1368 - $_msg_context = trim(substr($_values,$_str_start_aux,$this->messageContextLen));  
1369 -  
1370 - $_str_start_aux = $this->messageCountryLen+$this->messageCodeLen+$this->messageContextLen;  
1371 - $_msg_type = trim(substr($_values,$_str_start_aux,$this->messageTypeLen));  
1372 -  
1373 - $_str_start_aux = $this->messageCountryLen+$this->messageCodeLen+  
1374 - $this->messageContextLen+$this->messageTypeLen;  
1375 - $_msg_abbr = trim(substr($_values,$_str_start_aux,$this->messageAbbrLen));  
1376 -  
1377 - $_str_start_aux = $this->messageCountryLen+$this->messageCodeLen+  
1378 - $this->messageContextLen+$this->messageTypeLen+$this->messageAbbrLen;  
1379 - $_msg_text = trim(substr($_values,$_str_start_aux));  
1380 -  
1381 - $_language_data[$_lang][$_msg_code]['text'] = $_msg_text;  
1382 - $_language_data[$_lang][$_msg_code]['context'] = $_msg_context;  
1383 - $_language_data[$_lang][$_msg_code]['type'] = $_msg_type;  
1384 - $_language_data[$_lang][$_msg_code]['abbr'] = $_msg_abbr;  
1385 - $_language_data[$_lang][$_msg_code]['lang'] = $_abbr_i18n;  
1386 - }  
1387 -  
1388 - @asort($_language_data[$_abbr_i18n]);  
1389 -  
1390 - return $_language_data[$_abbr_i18n];  
1391 -  
1392 - } // end func: _getLangFile  
1393 -  
1394 - /**  
1395 - * Atribui o tamanho do campo de codigo (abbrI18N) do idioma  
1396 - * @access public  
1397 - * @param boolean $_length Tamnho a ser atribuido  
1398 - */  
1399 - function setLangCountryLength( $_length ) {  
1400 - $this->messageCountryLen = $_length;  
1401 - } // end func: setLangCountryLength  
1402 -  
1403 - /**  
1404 - * Atribui o tamanho do campo de codigo da messagem  
1405 - * @access public  
1406 - * @param boolean $_length Tamnho a ser atribuido  
1407 - */  
1408 - function setLangMsgCodeLength( $_length ) {  
1409 - $this->messageCodeLen = $_length;  
1410 - } // end func: setLangMsgCodeLength  
1411 -  
1412 - /**  
1413 - * Atribui o tamanho do campo de tipo da messagem  
1414 - * @access public  
1415 - * @param boolean $_length Tamnho a ser atribuido  
1416 - */  
1417 - function setLangMsgTypeLength( $_length ) {  
1418 - $this->messageTypeLen = $_length;  
1419 - } // end func: setLangMsgTypeLength  
1420 -  
1421 - /**  
1422 - * Atribui o tamanho do campo de contexto da messagem  
1423 - * @access public  
1424 - * @param boolean $_length Tamnho a ser atribuido  
1425 - */  
1426 - function setLangMsgContextLength( $_length ) {  
1427 - $this->messageContextLen = $_length;  
1428 - } // end func: setLangMsgContextLength  
1429 -  
1430 - /**  
1431 - * Atribui o tamanho do campo da abreviatura da messagem  
1432 - * @access public  
1433 - * @param boolean $_length Tamnho a ser atribuido  
1434 - */  
1435 - function setLangMsgAbbrLength( $_length ) {  
1436 - $this->messageAbbrLen = $_length;  
1437 - } // end func: setLangMsgAbbrLength  
1438 -  
1439 - /**  
1440 - * Atribui que o caminho dos arquivos de idiomas ficarao em subdiretorios abbrI18N  
1441 - * @access public  
1442 - * @param boolean $_filesInSubDirs TRUE - em subdiretorio abbrI18N  
1443 - * FALSE - sem subdiretorio abbrI18N (default)  
1444 - */  
1445 - function setLangFilesInSubDirs($_filesInSubDirs=false) {  
1446 - $this->languageFilesubdir = $_filesInSubDirs;  
1447 - } // end func: setLangFilesInSubDir  
1448 -  
1449 - /**  
1450 - * Atribui que os arquivos de idiomas serao seccionados conforme contextualizacao  
1451 - * @access public  
1452 - * @param boolean $_filesInSections TRUE - seccionados  
1453 - * FALSE - nao seccionados (default)  
1454 - */  
1455 - function setLangFilesInSections($_filesInSections=false) {  
1456 - $this->languageFileInSections = $_filesInSections;  
1457 - } // end func: setLangFilesInSections  
1458 -  
1459 - /**  
1460 - * Atribui a secao ativa a ser mostrada a TAG em "showTagHeader"  
1461 - * @access public  
1462 - * @param string $_activeSection O nome da seccao ativa (ex: admin ou setup)  
1463 - * Obs: Deve ser o nome interno e nao a traducao  
1464 - */  
1465 - function setActiveSection($_activeSection="") {  
1466 - $this->languageSectionActive = $_activeSection;  
1467 - } // end func: setActiveSection  
1468 -  
1469 - /**  
1470 - * Se necessario remove a contra barra do texto  
1471 - * @access private  
1472 - * @param string $_text O texto a ser tratado  
1473 - */  
1474 - function stripContraBarra( $_text ) {  
1475 - if( get_magic_quotes_gpc() ) {  
1476 - $_text = stripslashes($_text);  
1477 - }  
1478 -  
1479 - return $_text;  
1480 - } // end stripContraBarra  
1481 -  
1482 - /**  
1483 - * Ativa o modo "debug" do phpTranslator passando a mostrar as mensagens internas  
1484 - * @access public  
1485 - */  
1486 - function debugOn() {  
1487 - $this->_debugTranslator = true;  
1488 - } // end debugOn  
1489 -  
1490 - /**  
1491 - * Desativa o modo "debug" do phpTranslator deixando de mostrar as mensagens internas  
1492 - * @access public  
1493 - */  
1494 - function debugOff() {  
1495 - $this->_debugTranslator = false;  
1496 - } // end debugOff  
1497 -  
1498 - /**  
1499 - * Desativa o modo "debug" do phpTranslator deixando de mostrar as mensagens internas  
1500 - * @access public  
1501 - * @return boolean - True = em modo "debug"; FALSE = nao esta em modo "debug"  
1502 - */  
1503 - function inDebugMode() {  
1504 - return $this->_debugTranslator;  
1505 - } // end inDebugMode  
1506 -  
1507 - /*  
1508 - * Deprecated Methods  
1509 - */  
1510 -  
1511 - /* END OF DEPRECATED METHODS */  
1512 - } // end Class: Translator 1500 + function varDump($arg) {
  1501 + echo "<pre>";
  1502 + var_dump($arg);
  1503 + echo "</pre>";
  1504 + }
  1505 +
  1506 + /*
  1507 + * Deprecated Methods
  1508 + */
  1509 +
  1510 + /* END OF DEPRECATED METHODS */
  1511 +} // end Class: Translator
1513 ?> 1512 ?>
bibliotecas/phpTranslator/index.php
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 5
6 6
7 // Classe de traducao 7 // Classe de traducao
8 - $objTranslator = new Translator('pt-br', "en-us"); 8 + $objTranslator = new Translator("en-us",'','pt-br');
9 $objTranslator->SetLangFilePath("./languages/"); 9 $objTranslator->SetLangFilePath("./languages/");
10 10
11 //* Teste com "seccoes" 11 //* Teste com "seccoes"
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 ); 21 );
22 22
23 //$objTranslator->setLangFilesInSections(true); 23 //$objTranslator->setLangFilesInSections(true);
24 - //$objTranslator->setLangSections($_lang_sections); 24 + //$objTranslator->setLangFileSections($_lang_sections);
25 25
26 $objTranslator->BuildLangArray(); 26 $objTranslator->BuildLangArray();
27 $objTranslator->BuildLangArray('target'); 27 $objTranslator->BuildLangArray('target');
bibliotecas/phpTranslator/languages/language.en-us.inc.php
1 en-us #phptranslator_mnt_code_advise# Tradutor info * - The field could not be changed! 1 en-us #phptranslator_mnt_code_advise# Tradutor info * - The field could not be changed!
2 -en-us #phptranslator_sigla# Tradutor info Abbreviation  
3 -en-us #phptranslator_page_title# Tradutor info Application Translator  
4 -en-us #phptranslator_array parameter required# Tradutor error Array parameter required!  
5 -en-us #phptranslator_i18n_pt-br# Tradutor info Brasilian Portuguese  
6 en-us #phptranslator_alterar# Tradutor info Change 2 en-us #phptranslator_alterar# Tradutor info Change
  3 +en-us #phptranslator_file# Tradutor info File
  4 +en-us #phptranslator_language file# Tradutor Language file
  5 +en-us #phptranslator_section array not defined# Tradutor error Section array not defined!
  6 +en-us #phptranslator_cancelar# Tradutor info Cancel
  7 +en-us #phptranslator_codificacao de idioma padrao# Tradutor info Standard Language setup
  8 +en-us #phptranslator_contexto da mensagem# Tradutor info Message context
  9 +en-us #phptranslator_criar idioma# Tradutor info Create Language
  10 +en-us #phptranslator_codigo da mensagem# Tradutor info Message code
  11 +en-us #phptranslator_directory# Tradutor Directory
7 en-us #phptranslator_excluir# Tradutor info Delete 12 en-us #phptranslator_excluir# Tradutor info Delete
8 en-us #phptranslator_excluir codigo# Tradutor info Delete code base 13 en-us #phptranslator_excluir codigo# Tradutor info Delete code base
9 -en-us #phptranslator_directory# Tradutor Directory  
10 -en-us #phptranslator_file# Tradutor info File 14 +en-us #phptranslator_falta selecionar mensagem a ser alterada# Tradutor warn You need to choose a message to change
  15 +en-us #phptranslator_falta selecionar mensagem a ser excluida# Tradutor warn You need to choose a message to delete
11 en-us #phptranslator_geral# Tradutor info General 16 en-us #phptranslator_geral# Tradutor info General
12 -en-us #phptranslator_inserir# Tradutor info Insert  
13 en-us #phptranslator_idioma# Tradutor info Language 17 en-us #phptranslator_idioma# Tradutor info Language
14 -en-us #phptranslator_language file# Tradutor Language file 18 +en-us #phptranslator_inserir# Tradutor info Insert
  19 +en-us #phptranslator_listagem de mensagens padrao codificadas# Tradutor info Standard Messages - Setup report
15 en-us #phptranslator_listar# Tradutor info List 20 en-us #phptranslator_listar# Tradutor info List
16 en-us #phptranslator_mensagem# Tradutor info Message 21 en-us #phptranslator_mensagem# Tradutor info Message
17 -en-us #phptranslator_sigla para a mensagem# Tradutor info Message Abbreviation  
18 -en-us #phptranslator_codigo da mensagem# Tradutor info Message code  
19 -en-us #phptranslator_contexto da mensagem# Tradutor info Message context  
20 -en-us #phptranslator_tipo da mensagem# Tradutor info Message type  
21 -en-us #phptranslator_not found# Tradutor error Not found  
22 en-us #phptranslator_objtemplate# Tradutor Object template 22 en-us #phptranslator_objtemplate# Tradutor Object template
  23 +en-us #phptranslator_array parameter required# Tradutor error Array parameter required!
  24 +en-us #phptranslator_i18n_pt-br# Tradutor info Brasilian Portuguese
23 en-us #phptranslator_restaurar# Tradutor info Reset 25 en-us #phptranslator_restaurar# Tradutor info Reset
24 en-us #phptranslator_salvar# Tradutor info Save 26 en-us #phptranslator_salvar# Tradutor info Save
25 -en-us #phptranslator_section array not defined# Tradutor error Section array not defined! 27 +en-us #phptranslator_without write permition# Tradutor Without write permition
  28 +en-us #phptranslator_sigla# Tradutor info Abbreviation
  29 +en-us #phptranslator_sigla para a mensagem# Tradutor info Message Abbreviation
26 en-us #phptranslator_simbolo# Tradutor info Simbol 30 en-us #phptranslator_simbolo# Tradutor info Simbol
  31 +en-us #phptranslator_text# Tradutor Text
27 en-us #phptranslator_texto padrao# Tradutor info Standar text 32 en-us #phptranslator_texto padrao# Tradutor info Standar text
28 -en-us #phptranslator_codificacao de idioma padrao# Tradutor info Standard Language setup 33 +en-us #phptranslator_texto traduzido# Tradutor info Translated text
  34 +en-us #phptranslator_tipo da mensagem# Tradutor info Message type
29 en-us #phptranslator_traducao do idioma padrao# Tradutor info Standard Language translation 35 en-us #phptranslator_traducao do idioma padrao# Tradutor info Standard Language translation
30 -en-us #phptranslator_listagem de mensagens padrao codificadas# Tradutor info Standard Messages - Setup report  
31 -en-us #phptranslator_text# Tradutor Text  
32 en-us #phptranslator_traduzir# Tradutor info Translate 36 en-us #phptranslator_traduzir# Tradutor info Translate
33 en-us #phptranslator_traduzir para# Tradutor info Translate to 37 en-us #phptranslator_traduzir para# Tradutor info Translate to
34 -en-us #phptranslator_texto traduzido# Tradutor info Translated text  
35 -en-us #phptranslator_without write permition# Tradutor Without write permition  
36 -en-us #phptranslator_falta selecionar mensagem a ser alterada# Tradutor warn You need to choose a message to change  
37 -en-us #phptranslator_falta selecionar mensagem a ser excluida# Tradutor warn You need to choose a message to delete 38 +en-us #phptranslator_page_title# Tradutor info Application Translator
  39 +en-us #phptranslator_not found# Tradutor error Not found
38 en-us tradutor Tradutor TagHeader phpTranslator 40 en-us tradutor Tradutor TagHeader phpTranslator
bibliotecas/phpTranslator/languages/language.pt-br.inc.php
1 pt-br #phptranslator_mnt_code_advise# Tradutor info * - O campo não poderá ser alterado! 1 pt-br #phptranslator_mnt_code_advise# Tradutor info * - O campo não poderá ser alterado!
2 -pt-br #phptranslator_sigla# Tradutor info Sigla  
3 -pt-br #phptranslator_page_title# Tradutor info Tradução de textos de Aplicações  
4 -pt-br #phptranslator_array parameter required# Tradutor error Parâmetro deve ser array!  
5 -pt-br #phptranslator_i18n_pt-br# Tradutor info pt-br Português Brasileiro  
6 pt-br #phptranslator_alterar# Tradutor info Alterar 2 pt-br #phptranslator_alterar# Tradutor info Alterar
  3 +pt-br #phptranslator_file# Tradutor info Arquivo
  4 +pt-br #phptranslator_language file# Tradutor Arquivo de idioma
  5 +pt-br #phptranslator_section array not defined# Tradutor error Array de secções não definido!
  6 +pt-br #phptranslator_cancelar# Tradutor info Cancelar
  7 +pt-br #phptranslator_codificacao de idioma padrao# Tradutor info Codificação de Idioma Padrão
  8 +pt-br #phptranslator_contexto da mensagem# Tradutor info Contexto da mensagem
  9 +pt-br #phptranslator_criar idioma# Tradutor info Criar idioma
  10 +pt-br #phptranslator_codigo da mensagem# Tradutor info Código da Mensagem
  11 +pt-br #phptranslator_directory# Tradutor Diretório
7 pt-br #phptranslator_excluir# Tradutor info Excluir 12 pt-br #phptranslator_excluir# Tradutor info Excluir
8 pt-br #phptranslator_excluir codigo# Tradutor info Excluir código da base? 13 pt-br #phptranslator_excluir codigo# Tradutor info Excluir código da base?
9 -pt-br #phptranslator_directory# Tradutor Diretório  
10 -pt-br #phptranslator_file# Tradutor info Arquivo 14 +pt-br #phptranslator_falta selecionar mensagem a ser alterada# Tradutor warn Falta selecionar mensagem a ser alterada.
  15 +pt-br #phptranslator_falta selecionar mensagem a ser excluida# Tradutor warn Falta selecionar mensagem a ser excluída
11 pt-br #phptranslator_geral# Tradutor info Geral 16 pt-br #phptranslator_geral# Tradutor info Geral
12 -pt-br #phptranslator_inserir# Tradutor info Inserir  
13 pt-br #phptranslator_idioma# Tradutor info Idioma 17 pt-br #phptranslator_idioma# Tradutor info Idioma
14 -pt-br #phptranslator_language file# Tradutor Arquivo de idioma 18 +pt-br #phptranslator_inserir# Tradutor info Inserir
  19 +pt-br #phptranslator_listagem de mensagens padrao codificadas# Tradutor info Listagem de mensagens padrão codificadas
15 pt-br #phptranslator_listar# Tradutor info Listar 20 pt-br #phptranslator_listar# Tradutor info Listar
16 pt-br #phptranslator_mensagem# Tradutor info Mensagem 21 pt-br #phptranslator_mensagem# Tradutor info Mensagem
17 -pt-br #phptranslator_sigla para a mensagem# Tradutor info Sigla para a mensagem  
18 -pt-br #phptranslator_codigo da mensagem# Tradutor info Código da Mensagem  
19 -pt-br #phptranslator_contexto da mensagem# Tradutor info Contexto da mensagem  
20 -pt-br #phptranslator_tipo da mensagem# Tradutor info Tipo da mensagem  
21 -pt-br #phptranslator_not found# Tradutor error não encontrado  
22 pt-br #phptranslator_objtemplate# Tradutor Object template 22 pt-br #phptranslator_objtemplate# Tradutor Object template
  23 +pt-br #phptranslator_array parameter required# Tradutor error Parâmetro deve ser array!
  24 +pt-br #phptranslator_i18n_pt-br# Tradutor info pt-br Português Brasileiro
23 pt-br #phptranslator_restaurar# Tradutor info Restaurar 25 pt-br #phptranslator_restaurar# Tradutor info Restaurar
24 pt-br #phptranslator_salvar# Tradutor info Salvar 26 pt-br #phptranslator_salvar# Tradutor info Salvar
25 -pt-br #phptranslator_section array not defined# Tradutor error Array de secções não definido! 27 +pt-br #phptranslator_without write permition# Tradutor Sem permissão de escrita
  28 +pt-br #phptranslator_sigla# Tradutor info Sigla
  29 +pt-br #phptranslator_sigla para a mensagem# Tradutor info Sigla para a mensagem
26 pt-br #phptranslator_simbolo# Tradutor info Símbolo 30 pt-br #phptranslator_simbolo# Tradutor info Símbolo
  31 +pt-br #phptranslator_text# Tradutor Texto
27 pt-br #phptranslator_texto padrao# Tradutor info Texto padrão 32 pt-br #phptranslator_texto padrao# Tradutor info Texto padrão
28 -pt-br #phptranslator_codificacao de idioma padrao# Tradutor info Codificação de Idioma Padrão 33 +pt-br #phptranslator_texto traduzido# Tradutor info Texto traduzido
  34 +pt-br #phptranslator_tipo da mensagem# Tradutor info Tipo da mensagem
29 pt-br #phptranslator_traducao do idioma padrao# Tradutor info Traducao do idioma padrao 35 pt-br #phptranslator_traducao do idioma padrao# Tradutor info Traducao do idioma padrao
30 -pt-br #phptranslator_listagem de mensagens padrao codificadas# Tradutor info Listagem de mensagens padrão codificadas  
31 -pt-br #phptranslator_text# Tradutor Texto  
32 pt-br #phptranslator_traduzir# Tradutor info Traduzir 36 pt-br #phptranslator_traduzir# Tradutor info Traduzir
33 pt-br #phptranslator_traduzir para# Tradutor info Traduzir para 37 pt-br #phptranslator_traduzir para# Tradutor info Traduzir para
34 -pt-br #phptranslator_texto traduzido# Tradutor info Texto traduzido  
35 -pt-br #phptranslator_without write permition# Tradutor Sem permissão de escrita  
36 -pt-br #phptranslator_falta selecionar mensagem a ser alterada# Tradutor warn Falta selecionar mensagem a ser alterada.  
37 -pt-br #phptranslator_falta selecionar mensagem a ser excluida# Tradutor warn Falta selecionar mensagem a ser excluída 38 +pt-br #phptranslator_page_title# Tradutor info Tradução de textos de Aplicações
  39 +pt-br #phptranslator_not found# Tradutor error não encontrado
38 pt-br tradutor Tradutor TagHeader phpTranslator 40 pt-br tradutor Tradutor TagHeader phpTranslator
bibliotecas/phpTranslator/templates/css/tagheader.css
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 float: left; 4 float: left;
5 width: 100%; 5 width: 100%;
6 font-size: 93%; 6 font-size: 93%;
  7 + font-weight: bold;
7 line-height: normal; 8 line-height: normal;
8 } 9 }
9 10
@@ -11,6 +12,7 @@ @@ -11,6 +12,7 @@
11 padding: 10px 10px 0pt; 12 padding: 10px 10px 0pt;
12 list-style-type: none; 13 list-style-type: none;
13 list-style-image: none; 14 list-style-image: none;
  15 + font-weight: bold;
14 list-style-position: outside; 16 list-style-position: outside;
15 } 17 }
16 18
@@ -18,6 +20,7 @@ @@ -18,6 +20,7 @@
18 padding: 0pt 0pt 0pt 9px; 20 padding: 0pt 0pt 0pt 9px;
19 background: transparent url(../img/tagheader-left.gif) no-repeat scroll left top; 21 background: transparent url(../img/tagheader-left.gif) no-repeat scroll left top;
20 float: left; 22 float: left;
  23 + font-weight: bold;
21 display: block; 24 display: block;
22 } 25 }
23 26
@@ -33,13 +36,15 @@ @@ -33,13 +36,15 @@
33 cursor: pointer; 36 cursor: pointer;
34 } 37 }
35 38
36 - #tagheader span:hover { color: rgb(60, 88, 219); 39 + #tagheader span:hover { color: #C64934;
37 text-decoration: underline; 40 text-decoration: underline;
  41 + font-weight: bold;
38 } 42 }
39 43
40 #tagheader #tagcurrent span { background-image: url(../img/tagheader-right_on.gif); 44 #tagheader #tagcurrent span { background-image: url(../img/tagheader-right_on.gif);
41 color: rgb(51, 51, 51); 45 color: rgb(51, 51, 51);
42 cursor: default; 46 cursor: default;
  47 + font-weight: bold;
43 text-decoration: none; 48 text-decoration: none;
44 } 49 }
45 50
bibliotecas/phpTranslator/templates/img/tagheader-bg.gif

153 Bytes | W: | H:

67 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
bibliotecas/phpTranslator/templates/img/tagheader-left.gif

369 Bytes | W: | H:

505 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
bibliotecas/phpTranslator/templates/img/tagheader-left_on.gif

354 Bytes | W: | H:

132 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
bibliotecas/phpTranslator/templates/img/tagheader-right.gif

1.51 KB | W: | H:

1.63 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
bibliotecas/phpTranslator/templates/img/tagheader-right_on.gif

1.26 KB | W: | H:

260 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
bibliotecas/phpTranslator/templates/translate_createlang.html 0 → 100644
@@ -0,0 +1,73 @@ @@ -0,0 +1,73 @@
  1 +<mos:comment>
  2 +@version 0.0.1
  3 +@package phpTranslate
  4 +@copyright (C) 2005 Adriano dos Santos Vieira
  5 +@license http://www.gnu.org/copyleft/gpl.html GNU/GPL
  6 +@description Templates para manutencao de idioma padrao
  7 +</mos:comment>
  8 +
  9 + <mos:comment>
  10 + Cria/Altera padroes do idioma padrao
  11 + </mos:comment>
  12 + <mos:tmpl name="translate_langdef">
  13 + <table class="adminheading" width="100%">
  14 + <tr>
  15 + <th>Criar idioma {STANDARD_LANG_CODING}</th>
  16 + </tr>
  17 + </table>
  18 + <table class="adminlist" width="100%">
  19 + <tr>
  20 + <td valign="top">Descricao {STANDARD_LANG_CODING_MSG}</td>
  21 + <td valign="top">
  22 + <input class="inputbox" type="text" name="mnt_language[text]" value="{LANG_ABBR}" size="{LANG_ABBR_LEN}" maxlength="{LANG_ABBR_LEN}" />
  23 + </td>
  24 + </tr>
  25 + <tr>
  26 + <td>Sigla {STANDARD_LANG_CODING_LANG}</td>
  27 + <td>
  28 + <input class="inputbox" type="text" name="mnt_language[lang]" value="{LANG_COUNTRY}" size="{LANG_COUNTRY_LEN}" maxlength="{LANG_COUNTRY_LEN}" />
  29 + </td>
  30 + </tr>
  31 + <tr>
  32 + <td>Charset {STANDARD_LANG_CODING_CONTEXT}</td>
  33 + <td>
  34 + <input class="inputbox" type="text" name="mnt_language[context]" value="{LANG_CONTEXT}" size="{LANG_CONTEXT_LEN}" maxlength="{LANG_CONTEXT_LEN}" />
  35 + </td>
  36 + </tr>
  37 + <tr>
  38 + <td>Direção de escrita{STANDARD_LANG_CODING_MSG_CODE}</td>
  39 + <td>
  40 + <input type="hidden" name="mnt_language[code]" value="{LANG_CODE}" />
  41 + <input {LANG_CODE_DISABLED} class="inputbox" type="text" name="mnt_language[code]" value="{LANG_CODE}" maxlength="{LANG_CODE_LEN}" />
  42 + </td>
  43 + </tr>
  44 + <tr>
  45 + <td>Versão{STANDARD_LANG_CODING_MSG_TYPE}</td>
  46 + <td>
  47 + <input class="inputbox" type="text" name="mnt_language[type]" value="{LANG_TYPE}" size="{LANG_TYPE_LEN}" maxlength="{LANG_TYPE_LEN}" />
  48 + </td>
  49 + </tr>
  50 + <tr>
  51 + <td>Versão do CACIC{STANDARD_LANG_CODING_MSG_ABBR}</td>
  52 + <td>
  53 + <input class="inputbox" type="text" name="mnt_language[abbr]" value="{LANG_ABBR}" size="{LANG_ABBR_LEN}" maxlength="{LANG_ABBR_LEN}" />
  54 + </td>
  55 + </tr>
  56 + <tr align="right">
  57 + <td colspan="2">
  58 + <input class="button" type="submit" name="mnt_lang_action[salvar_langdef]" value="{BTN_SALVAR}" />
  59 + <input class="button" type="submit" name="mnt_lang_action[cancelar_langdef]" value="{BTN_CANCELAR}" />
  60 + <input class="button" type="reset" name="reset" value="{BTN_RESTAURAR}" />
  61 + </td>
  62 + </tr>
  63 + <tfoot>
  64 + <tr>
  65 + <td colspan="2">
  66 + <small>{STANDARD_LANG_CODING_ADVISE}</small>
  67 + </td>
  68 + </tr>
  69 + </tfoot>
  70 + </table>
  71 +
  72 + </mos:tmpl>
  73 +
bibliotecas/phpTranslator/templates/translate_mnt_tmpl.html
@@ -159,6 +159,7 @@ @@ -159,6 +159,7 @@
159 <input class="button" type="submit" name="mnt_lang_action[tradutor]" value="{BTN_TRADUZIR}" /> 159 <input class="button" type="submit" name="mnt_lang_action[tradutor]" value="{BTN_TRADUZIR}" />
160 </mos:sub> 160 </mos:sub>
161 <mos:sub condition="translate"> 161 <mos:sub condition="translate">
  162 + <!-- input class="button" type="submit" name="mnt_lang_action[create_lang]" value="{BTN_CREATE_LANG}" / -->
162 <input class="button" type="submit" name="save_translation" value="{BTN_SALVAR}" /> 163 <input class="button" type="submit" name="save_translation" value="{BTN_SALVAR}" />
163 <input class="button" type="reset" name="reset" value="{BTN_RESTAURAR}" /> 164 <input class="button" type="reset" name="reset" value="{BTN_RESTAURAR}" />
164 </mos:sub> 165 </mos:sub>