<?php // Script to tag translation files with the corresponding %lang(). include("includes/translate.php"); define_languages(); $matches = array(); $line = rtrim(fgets(STDIN)); while (!feof(STDIN)) { if (preg_match('#/translations/(.*)\.txt$#', $line, $matches)) { $abbrev = languageToAbbrev($matches[1]); if ($abbrev === FALSE) { $lang = array_search($matches[1], $languages); if ($lang !== FALSE) { $lang = explode(' ', $lang); $abbrev = languageToAbbrev($lang[0]); } } if ($abbrev !== FALSE) $line = "%lang($abbrev) $line"; } echo "$line\n"; $line = rtrim(fgets(STDIN)); } exit(0); ?>