96 global $APPLICATION, $USER;
98 if (!$USER instanceof \CUser || !$USER->isAuthorized())
108 if (($_SESSION[
"SHOW_LANG_FILES"] ??
'') !==
'Y')
113 $request = Main\Context::getCurrent()->getRequest();
116 if ($request->isAjaxRequest() || $request->get(
'AJAX_CALL') !==
null)
121 $searchString = $request->get(
'srchlngfil');
123 \CJSCore::init(
'admin_interface');
124 if (!defined(
"ADMIN_SECTION"))
126 $APPLICATION->setAdditionalCSS(
'/bitrix/themes/.default/pubstyles.css');
129 $popup = new \CJSPopupOnPage();
133 <script type=
"text/javascript">
134 var <?= self::DIALOG_ID ?> =
new BX.CDebugDialog();
138 $popup->startDescription(
'bx-translate-search');
139 $popup->startContent(array(
'buffer' =>
true));
142 if(!defined(
'BX_PUBLIC_MODE'))
146 <input type=
"text" size=
"50" class=
"typeinput" name=
"srchlngfil" value=
"<?= \htmlspecialcharsbx($searchString) ?>">
147 <input type=
"submit" class=
"button" value=
"OK">
153 <div
id=
"BX_TRANSLATE_FILES">
154 <style type=
"text/css">
155 .bx-translate-files-table {width: 100%; border: none; border-spacing:0; }
156 .bx-translate-files-table td {padding: 0 4px 4px 0; border:none; vertical-align:top; }
157 .bx-component-debug.bx-debug-summary.bx-translate-debug-summary { left:unset; right: 10px; }
159 <table
class=
"bx-translate-files-table">
163 if (!empty($includedLangFiles))
165 $includedLangFiles = \array_values($includedLangFiles);
167 $lowPriorityLangFiles = array();
168 $highPriorityLangFiles = array();
169 foreach ($includedLangFiles as $langFile)
171 $langFile = Main\IO\Path::normalize($langFile);
177 $langFile = \str_replace(
188 $langFile = \str_replace(
197 $langFile = \str_replace(
203 if (empty($langFile))
209 (\mb_strpos($langFile,
"/menu") !==
false) ||
210 (\mb_strpos($langFile,
"/classes") !==
false) ||
211 (\mb_strpos($langFile,
"tools.") !==
false) ||
212 (\mb_strpos($langFile,
"/include.") !==
false) ||
213 (\mb_strpos($langFile,
"menu_template.php") !==
false) ||
214 (\mb_strpos($langFile,
".menu.") !==
false) ||
215 (\mb_strpos($langFile,
"/top_panel.php") !==
false) ||
216 (\mb_strpos($langFile,
"prolog_main_admin.php") !==
false) ||
217 (\mb_strpos($_SERVER[
"REQUEST_URI"],
"/iblock_") ===
false && \mb_strpos($langFile,
"/modules/iblock/lang/")!==
false)
220 $lowPriorityLangFiles[] = $langFile;
224 $highPriorityLangFiles[] = $langFile;
229 $lowPriorityLangFiles = \array_unique($lowPriorityLangFiles);
230 $highPriorityLangFiles = \array_unique($highPriorityLangFiles);
232 \asort($lowPriorityLangFiles);
233 \reset($lowPriorityLangFiles);
235 $highPriorityLangFiles = \array_reverse($highPriorityLangFiles,
true);
237 $includedLangFiles = \array_merge($highPriorityLangFiles, $lowPriorityLangFiles);
239 if ($searchString !==
null)
241 $lookForCode = \preg_match(
"/[a-z1-9_]+/i", $searchString);
244 foreach ($includedLangFiles as $langFile)
248 if ($searchString !==
null)
252 $filePath = Localization\Translation::convertLangPath($_SERVER[
"DOCUMENT_ROOT"]. $langFile, \LANGUAGE_ID);
253 if (\file_exists($filePath))
255 $filePath = \str_replace(
'/lang/'.\LANGUAGE_ID.
'/',
'/', $langFile);
259 foreach ($messages as $code => $phrase)
262 $lookForCode && \mb_strpos($code, $searchString) !==
false ||
263 \mb_strpos($phrase, $searchString) !==
false
267 $highlight =
"&highlight=". \preg_replace(
"/[^a-z1-9_]+/i",
'', $code);
268 $stf .=
'<a href="/bitrix/admin/translate_edit.php?lang='.\LANGUAGE_ID.
'&file='.$langFile. $highlight.
'">'.
269 \htmlspecialcharsbx($phrase).
281 <td><a href=
"/bitrix/admin/translate_edit.php?lang=<?= \LANGUAGE_ID ?>&file=<?= $langFile ?>"><?= $langFile ?></a></td>
291 $popup->endContent();
293 $popup->startButtons();
294 $popup->showStandardButtons(array(
'close'));
296 if ($searchString !==
null)
299 <script type=
"text/javascript">
BX.ready(
function(){ <?= self::DIALOG_ID ?>.Show(); });</script>
303 if (defined(
"ADMIN_SECTION"))
307 div.bx-component-debug {border:1px solid red; font-size:11px; color:black; background-color:white; text-align:left; }
308 div.bx-component-debug a, div.bx-component-debug a:visited {color:blue; text-decoration:none;}
309 div.bx-component-debug a:hover {color:red; text-decoration:underline}
310 div.bx-debug-summary {margin:5px; width:300px; padding:5px; position:fixed; bottom:10px; left:10px; z-index:1000; opacity: 0.4;}
311 div.bx-debug-summary:hover {opacity: 1;}
316 <div
class=
"bx-component-debug bx-debug-summary bx-translate-debug-summary">
317 <?=
Loc::getMessage(
"TRANSLATE_COUNT_LOADED_LANG_FILES") ?>: <?= count($includedLangFiles) ?><br>
318 <a title=
"<?= Loc::getMessage("TRANSLATE_SHOW_LOADED_LANG_FILES_TITLE
") ?>" href=
"javascript:<?= self::DIALOG_ID ?>.Show();">