. * * @author Daniil Gentili * @copyright 2016-2023 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; /** @internal */ final class Lang { public const PERCENTAGES = %s; public static int $currentPercentage = 100; public static array $lang = %s; // THIS WILL BE OVERWRITTEN BY $lang["en"] public static array $current_lang = %s; }'; $base = json_decode(file_get_contents("langs/en.json"), true); $langs = []; $percentages = []; $res = json_decode(file_get_contents("https://weblate.madelineproto.xyz/api/projects/madelineproto/languages/"), true); foreach ($res as ['code' => $code, 'translated_percent' => $percent]) { $percentages[$code] = (int) $percent; } foreach (glob("langs/*.json") as $lang) { $code = basename($lang, '.json'); $langs[$code] = array_merge($base, json_decode(file_get_contents($lang), true)); ksort($langs[$code]); } file_put_contents('src/Lang.php', sprintf($template, var_export($percentages, true), var_export($langs, true), var_export($langs['en'], true)));