public static function templateProcess($template) {
        $new = preg_replace_callback(
            '|{{__ *\'([^\']*)\' *}}|',
            function ($matches) {
                return __(htmlent_utf8(trim($matches[1])));
            },
            $template
        );
        $new = preg_replace_callback(
            '|{{__ *"([^"]*)" *}}|',
            function ($matches) {
                return __(htmlent_utf8(trim($matches[1])));
            },
            $new
        );
        $new = preg_replace_callback(
            '|{{>> *([^ ]*) *}}|',
            function ($matches) {
                $name = 'templates/'.trim($matches[1]);
                if ( file_exists($name) ) {
                    return file_get_contents($name);
                }
                return "Unable to open $name";
            },
            $new
        );
        return $new;
    }