From 1d69235973bc235fb2729014c59d68711a44d91e Mon Sep 17 00:00:00 2001 From: Miraty Date: Sun, 29 Sep 2024 22:13:43 +0200 Subject: [PATCH] strip annoying gettext metadata --- mkht.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mkht.php b/mkht.php index ac61e7f..d80f5b6 100755 --- a/mkht.php +++ b/mkht.php @@ -80,8 +80,11 @@ foreach($nodes_src as $node) { copy($src, $target); } -if (file_exists(SITE . 'po4a.cfg')) +if (file_exists(SITE . 'po4a.cfg')) { exec('po4a --destdir ' . SITE . ' --srcdir ' . SITE . ' ' . SITE . 'po4a.cfg'); + foreach (glob('po/*.po*') as $gettext_file) // Remove annoying metadata generated by Gettext and translation tools + file_put_contents($gettext_file, preg_replace('/.*(POT-Creation-Date|PO-Revision-Date).*\n\n/sU', 'msgid ""' . LF . 'msgstr "Content-Type: text/plain; charset=UTF-8\n"' . LF . LF, file_get_contents($gettext_file))); +} $nodes_cache = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(SITE . 'cache/', RecursiveDirectoryIterator::SKIP_DOTS));