diff --git a/metadata/dbms/records.php b/metadata/dbms/records.php index 26274a5..c913ef5 100644 --- a/metadata/dbms/records.php +++ b/metadata/dbms/records.php @@ -153,8 +153,9 @@ } //Функция для перевода текста без применения GetText - function trt($text) - { + /* + закоментил так как есть в tools.php + function trt($text) { global $db,$lng,$Schema; $language_id=1; @@ -182,29 +183,32 @@ $result=str_replace("_", " ", $text); } return $result; - } + }*/ - //Перевод для строки в которой встречаются подстроки вида: _('') + //Перевод для строки в которой встречаются подстроки вида: trt('') function parseGT($text) { $result=''; + $pLen=4; //Длина преамбулы trt( $cut=0; $from = 0; // Позиция поиска для итерации while (true) { - $pos1 = strpos($text, '_(', $from); + $pos1 = strpos($text, 'trt(', $from); if($pos1 !== false) { - $from = $pos1+3; + $from = $pos1+$pLen+1; $pos2 = false; - if($text[$pos1+2] == '"') $pos2 = strpos($text, '")', $from); - if($text[$pos1+2] == '\'') $pos2 = strpos($text, '\')', $from); + if($text[$pos1+$pLen] == '"') $pos2 = strpos($text, '")', $from); + if($text[$pos1+$pLen] == '\'') $pos2 = strpos($text, '\')', $from); if($pos2 !== false) { $result.=substr($text, $cut, $pos1 - $cut ); - $result.=trt(substr($text, $pos1+3, $pos2 - $pos1 - 3 )); + $result.=__(substr($text, $pos1+3, $pos2 - $pos1 - 3 )); + $toTranslate=substr($text, $pos1+$pLen+1, $pos2 - $pos1 - $pLen-1 ); + $result.=trt($toTranslate); $cut=$pos2+2; - $from = $pos2 + 2; + $from = $pos2 + $pLen; } }else break; } @@ -1150,7 +1154,7 @@ if ($fn==8)//Получить отчёт как Excel.xls файл (почти тоже самое что и функция 4) { session_write_close(); //Разблокируем сессионный файл так как запросы могут быть достаточно долгими - //if (!isset($_SESSION['USER_ID']) || $_SESSION['USER_ID']=='') sendError(_('You are not logged in!')); + //if (!isset($_SESSION['USER_ID']) || $_SESSION['USER_ID']=='') sendError(trt('You are not logged in!')); //Выбираем информацию о текущем пользователе $name=''; @@ -1197,7 +1201,7 @@ setFilter($f1,$f2);//заменить все значения первого фильтра значениями из второго //Выбираем параметры фильтра (Для информирования что было заполнено) - $filter=''._('Filter options').'
'; + $filter=''.trt('Filter options').'
'; $nextnode=$f1->firstChild; while ($nextnode) { if ($nextnode->nodeName=='column') @@ -1235,7 +1239,7 @@ } catch (Exception $e) { sendError($e->getMessage()); } - if($res->rowCount()!=1) sendError(_('The number of records is not equal to one!').' '.$sql_query); + if($res->rowCount()!=1) sendError(trt('The number of records is not equal to one!').' '.$sql_query); $columns=explode(",",$nextnode->getAttribute('FieldCaption')); @@ -1300,8 +1304,8 @@ fwrite($fh, ' '."\n"); fwrite($fh, ' '."\n"); - fwrite($fh, ''._('Time and date of generation').': '.date('H:i:s m.d.Y').'
'); - fwrite($fh, ''._('Creator').': '.$name); + fwrite($fh, ''.trt('Time and date of generation').': '.date('H:i:s m.d.Y').'
'); + fwrite($fh, ''.trt('Creator').': '.$name); fwrite($fh, $filter); fwrite($fh, ' '."\n"); @@ -1367,7 +1371,7 @@ //deleteTempFiles($dir); }else { - sendError(_('Not found the requested node:').' "'.$typename.'"!'); + sendError(trt('Not found the requested node:').' "'.$typename.'"!'); } }else diff --git a/metadata/dbms/tools.js b/metadata/dbms/tools.js index 82f4947..4da618e 100644 --- a/metadata/dbms/tools.js +++ b/metadata/dbms/tools.js @@ -1,4 +1,24 @@ -//Copyright (C) Ivanov I.M. irigm@mail.ru +/*jshint esversion: 6 */ +"use strict"; + +//Массив g_translations подгружается отдельно +function trt(key) +{ + if(key==null || key===undefined) return ''; + let val=g_translations[key]; + if(val==null || val===undefined) + { + for(let item in g_translations) { + if(item.toLowerCase()==key.toLowerCase()) + { + val=g_translations[item]; + break; + } + } + } + if(val==null || val===undefined) return key.replace(/_/g, ' '); + else return val; +} //Расширить плитку чтобы она занимала всю штртну области function resizeDivTile(parent,minWidth) @@ -529,15 +549,13 @@ function setIframeSrc(iframeNode, src) // браузер хранится в объекте browser function createIFrame(fname, fsrc, parent, debug) { - var ifrstr = BrowserDetect.browser=='Explorer' ? '