2 /* vim: set expandtab sw=4 ts=4 sts=4 ft=php: */
4 $tmpDir = dirname(__FILE__) . '/../twig-templates';
5 $potName = 'po/phpmyadmin.pot';
6 $replacements = json_decode(file_get_contents($tmpDir . '/replace.json'), true);
9 $pot = file_get_contents($potName);
11 /* Do the replacements */
12 $pot = preg_replace_callback(
13 '@(twig-templates[0-9a-f/]*.php):([0-9]*)@',
16 $filename = $matches[1];
17 $line = intval($matches[2]);
18 $replace = $replacements[$filename];
19 foreach ($replace[1] as $cacheline => $result) {
20 if ($line >= $cacheline) {
21 return $replace[0] . ':' . $result;
24 return $replace[0] . ':0';
29 /* Write fixed file */
30 $handle = fopen($potName, 'w');
31 fwrite($handle, $pot);