#!/usr/bin/php
<?php

$lngs = array('e', 'g', 'f', 's', 'i');

foreach ($lngs as $lng) {
	$cont = file(__DIR__.'/../patch/'.$lng.'.txt');

	foreach ($cont as $c) {
		preg_match('@^\\[(.*)\\] (.*)@s', $c, $m);

		$key = $m[1];
		$msg = $m[2];

		$msg = str_replace("\n", '', $msg);
		$msg = str_replace("\r", '', $msg);
		$msg = str_replace('#', '', $msg);

		$msg_ = str_replace('#', '', $msg);
		$lastchar = substr($msg_, -1, 1);

		$punctation = ($lastchar == '.') || ($lastchar == '!') || ($lastchar == '?');

		if (!$punctation) {
			echo "Missing punctation at the end: ${lng}.txt [$key] $msg\n";
		}
	}
}
