1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-12-11 17:00:00 +01:00
MadelineProto/tools/build_docs/merge.php
2024-03-08 13:24:05 +01:00

33 lines
1.1 KiB
PHP

<?php declare(strict_types=1);
use danog\MadelineProto\Lang;
/**
* Merge extracted docs.
* @internal
*/
function mergeExtracted(): void
{
if (!file_exists('extracted.json')) {
return;
}
foreach (json_decode(file_get_contents('extracted.json'), true) as $key => $value) {
$key = html_entity_decode($key);
if ($key === 'method_messages.sendMultiMedia_param_multi_media_type_Vector<InputSingleMedia>') {
$value = 'The medias to send';
}
$key = preg_replace(['|flags\.\d+[?]|', '/Vector[<].*/'], ['', 'Vector t'], $key);
$key = str_replace('param_hash_type_int', 'param_hash_type_Vector t', $key);
$key = str_replace('param_peer_type_Peer', 'param_peer_type_long', $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;
}
}