1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
localizablemessage.php
См. документацию.
1<?php
2
3namespace Bitrix\Main\Localization;
4
5use Bitrix\Main\Diag;
6use Bitrix\Main\IO\Path;
7
18{
19 public function __construct(
20 protected string $code,
21 protected ?array $replace = null,
22 protected ?string $language = null,
23
25 protected ?string $phraseSrcFile = null,
26 )
27 {
28 if (!isset($this->phraseSrcFile))
29 {
30 // guess the file that owns the phrase
31 $trace = Diag\Helper::getBackTrace(1, DEBUG_BACKTRACE_IGNORE_ARGS);
32 $this->phraseSrcFile = Path::normalize($trace[0]['file']);
33 }
34 }
35
36 public function localize(string $language): ?string
37 {
38 $message = Loc::getMessage($this->code, $this->replace, $language);
39
40 if (!isset($message))
41 {
42 Loc::loadLanguageFile($this->phraseSrcFile, $language, false);
43 $message = Loc::getMessage($this->code, $this->replace, $language);
44 }
45
46 return $message;
47 }
48
49 public function __toString()
50 {
51 return $this->localize($this->language ?? Loc::getCurrentLang());
52 }
53}
static getBackTrace($limit=0, $options=null, $skip=1)
Определения helper.php:26
static loadLanguageFile($file, $language=null, $normalize=true)
Определения loc.php:225
static getCurrentLang()
Определения loc.php:79
static getMessage($code, $replace=null, $language=null)
Определения loc.php:30
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения options.php:195
$message
Определения payment.php:8