diff --git a/extract_strings.php b/extract_strings.php index 5cce9c1..df661f1 100644 --- a/extract_strings.php +++ b/extract_strings.php @@ -1,12 +1,15 @@ name == 'trans') { - echo $node->args[0]->value->value."\n"; + $translations[] = $node->args[0]->value->value; } } } @@ -24,3 +27,13 @@ try { } catch (PHPParser_Error $e) { echo 'Parse Error: ', $e->getMessage(); } + +foreach(glob('templates/*.twig') as $file) { + $content = file_get_contents($file); + preg_match_all('/{% trans %}(.*){% endtrans %}/',$content,$matches); + $translations = array_merge($translations,$matches[1]); +} + +$translations = array_unique($translations); + +print_r($translations); \ No newline at end of file