1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 03:14:39 +01:00
MadelineProto/tools/build_docs/merge.php
Daniil Gentili 499107af14
Some checks failed
ci/woodpecker/push/build Pipeline failed
Layer 151
2022-12-29 20:40:06 +01:00

28 lines
812 B
PHP

<?php declare(strict_types=1);
use danog\MadelineProto\Lang;
/**
* Merge extracted docs.
*
*/
function mergeExtracted(): void
{
if (!file_exists('extracted.json')) {
return;
}
foreach (json_decode(file_get_contents('extracted.json'), true) as $key => $value) {
$key = preg_replace(['|flags\.\d+[?]|', '/Vector[<].*/'], ['', 'Vector t'], $key);
$key = str_replace('param_hash_type_int', 'param_hash_type_Vector t', $key);
Lang::$lang['en'][$key] = $value;
}
foreach (Lang::$lang['en'] as $key => $value) {
if ($value === '') {
unset(Lang::$lang['en'][$key]);
}
}
foreach (json_decode(file_get_contents('docs/template/disallow.json'), true) as $key => $value) {
Lang::$lang['en']["method_$key"] = $value;
}
}