File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/js/ui/buttons/test/load-messages.js
Back
import { Loc } from 'main.core'; const fs = require('fs'); const path = require('path'); export default function loadMessages(lang = 'en') { const langFile = path.join(path.normalize(__dirname + '../../lang/'), lang, 'config.php'); const contents = fs.readFileSync(langFile, 'ascii'); const regex = /\$MESS\[['"](?<code>.+?)['"]]\s*=\s*['"](?<phrase>.*?)['"]/gm; let match; while ((match = regex.exec(contents)) !== null) { if (match.index === regex.lastIndex) { regex.lastIndex++; } const { code, phrase } = match.groups; Loc.setMessage(code, phrase); } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.25 |
proxy
|
phpinfo
|
Settings