B
B
bitrix0ID2019-10-15 10:32:06
1C-Bitrix
bitrix0ID, 2019-10-15 10:32:06

How to connect language constants to header.php?

Does Bitrix provide connection of language files for the template (header.php)? For some reason, constants are not obtained. The file is located at this address:

/templates/mytmpl/lang/en/header.php

I'm trying to get a constant using "getMessage" ("Loc::getMessage" also tried) - and nothing. Also, I called "includeTemplateLangFile(__FILE__)" at the beginning of the template - they still don't load.
You need to translate template files (header.php, footer.php, ...) into other languages.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Brekotkin, 2019-10-15
@bitrix0ID

At the beginning of the header At the right place Either on the new core:

<?
use Bitrix\Main\Localization\Loc;

Loc::loadLanguageFile(__FILE__);
?>

<? echo Loc::getMessage("CONST");?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question