--- /dev/null
+#!/usr/bin/php
+<?php
+/*=====================================================================*\
+|| ###################################################################
+|| # xgettext For ISSO PHP and Template Files [#]version[#]
+|| # Copyright ©2002-[#]year[#] Iris Studios, Inc.
+|| #
+|| # This program is free software; you can redistribute it and/or modify
+|| # it under the terms of the GNU General Public License as published by
+|| # the Free Software Foundation; version [#]gpl[#] of the License.
+|| #
+|| # This program is distributed in the hope that it will be useful, but
+|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+|| # more details.
+|| #
+|| # You should have received a copy of the GNU General Public License along
+|| # with this program; if not, write to the Free Software Foundation, Inc.,
+|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+|| ###################################################################
+\*=====================================================================*/
+
+require_once('/Server/htdocs/ISSO/Functions.php');
+
+// TODO - process $argv and translate them into xgettext arguments
+
+// ###################################################################
+// generate the list of files to process
+
+$filelist = BSFunctions::ScanDirectory('.');
+
+foreach ($filelist AS $dirpath => $nodes)
+{
+ $dirpath = ($dirpath ? BSFunctions::FetchSourcePath($dirpath) : '');
+ foreach ($nodes AS $file)
+ {
+ $ext = BSFunctions::FetchExtension($file);
+ if ($ext == 'php')
+ {
+ $files[] = '.' . BSFunctions::FetchSourcePath($search) . $dirpath . $file;
+ }
+ else if ($ext == 'xml' OR $ext == 'tpl' OR $ext == 'html' OR $ext == 'htm')
+ {
+ $templates[] = array(
+ 'orig' => '.' . BSFunctions::FetchSourcePath($search) . $dirpath . $file,
+ 'temp' => '.' . BSFunctions::FetchSourcePath($search) . $dirpath . 'xgtxt-' . $file . '.php'
+ );
+ }
+ }
+}
+
+// ###################################################################
+// compile the templates into gettext-friendly PHP code
+
+function process_template_text($text)
+{
+ return '<?php gettext("' . str_replace(array('\\\"', "'"), array('"', "\'"), $text) . '"); ?>';
+}
+
+foreach ($templates AS $paths)
+{
+ $template = file_get_contents($paths['orig']);
+
+ if (strpos($template, '{@') === false)
+ {
+ continue;
+ }
+
+ $template = str_replace('"', '\"', $template);
+
+ $template = preg_replace('#\{@\\\"(.*?)\\\"\}#ise', 'process_template_text(\'$1\')', $template);
+
+ print($template); exit;
+
+ file_put_contents($paths['temp'], preg_replace('#\{@"(.*)"\}#e', "process_template_text('\1')", $template));
+}
+
+/*=====================================================================*\
+|| ###################################################################
+|| # $HeadURL$
+|| # $Id$
+|| ###################################################################
+\*=====================================================================*/
+?>
\ No newline at end of file