]>
src.bluestatic.org Git - isso.git/blob - docs/makepo.sh.php
3 /*=====================================================================*\
4 || ###################################################################
5 || # xgettext For ISSO PHP and Template Files [#]version[#]
6 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
8 || # This program is free software; you can redistribute it and/or modify
9 || # it under the terms of the GNU General Public License as published by
10 || # the Free Software Foundation; version [#]gpl[#] of the License.
12 || # This program is distributed in the hope that it will be useful, but
13 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 || # You should have received a copy of the GNU General Public License along
18 || # with this program; if not, write to the Free Software Foundation, Inc.,
19 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
20 || ###################################################################
21 \*=====================================================================*/
23 require_once('/Server/htdocs/ISSO/Functions.php');
25 // ###################################################################
26 // generate the list of files to process
28 $filelist = BSFunctions
::ScanDirectory('.');
30 foreach ($filelist AS $file)
32 $ext = BSFunctions
::FetchExtension($file);
35 $files[dirname($file)] = BSFunctions
::FetchSourcePath(dirname($file)) . '*.php';
37 else if ($ext == 'xml' OR $ext == 'tpl' OR $ext == 'html' OR $ext == 'htm')
39 $files[dirname($file)] = BSFunctions
::FetchSourcePath(dirname($file)) . '*.php';
41 'orig' => BSFunctions
::FetchSourcePath('./' . $dirpath) . $file,
42 'temp' => BSFunctions
::FetchSourcePath('./' . $dirpath) . $file . '.xgt.php'
47 // ###################################################################
48 // compile the templates into gettext-friendly PHP code
50 function process_template_text($text)
52 return '<?php gettext("' . $text . '"); ?>';
55 foreach ($templates AS $paths)
57 $template = file_get_contents($paths['orig']);
59 $template = preg_replace('#\{@\\"(.*?)\\"\}#ise', 'process_template_text(\'$1\')', $template);
61 file_put_contents($paths['temp'], $template);
63 $removelater[] = $paths['temp'];
66 // ###################################################################
67 // run xgettext on all of the various files that we have now created
69 // get any arguments and just pass them to xgettext
73 exec('xgettext ' . implode(' ', $arguments) . ' ' . implode(' ', $files));
75 // ###################################################################
76 // remove all the files we no longer need
78 foreach ($removelater AS $path)
83 /*=====================================================================*\
84 || ###################################################################
87 || ###################################################################
88 \*=====================================================================*/