Copyright © 2004, 2005 by Jarno Elonen <elonen@iki.fi>
Pophorator is a gettext (.po) compatible L10N tool for statically translating strings in mixed PHP, HTML and Javascript files -- sort of "gettext for HTML" with PHP support. It is a command line program written in PHP. Contributions (preferably patch files) are welcome.
...or read the source code.
This is what the program outputs with --help:
pophorator 0.51 - Tool for localizing PHP, HTML and Javascript statically
Usage: pophorator -g <INFILE> [INFILE ...]
pophorator -p <INFILE>
-g Get strings from INFILE(s) and write a .pot into STDOUT
-p Apply .po strings from STDIN to INFILE and write to STDOUT
-h, --help Show this help
INFILEs are never modified, -p mode outputs the
changed version into STDOUT. The character encoding of INFILEs
is currently assumed to be in ISO-8859-1 whereas the output is in UTF-8.
HTML tags are abbreviated in the 'get' phase by removing all atributes
from them, e.g. '<a href="...">link</a>' becomes '<a>link</a>'. The
'put' phase puts them back.
Marking localizable strings:
PHP and Javascript:
Enclose strings into _() and mark comments with /**/. Example:
_( "End" /* Verb, end session */ )
HTML text:
Enclose text into <loc comment="..."></loc>. Example:
<a href="..."><loc comment="Verb, end session">End</loc></a>
HTML tag attributes:
List the localizable attributes in new attribute 'locattr',
separated by space, comma or semicolon. Put comments into
'loccomment' (currently shared between all the attributes). Example:
<a href=".." title="End" locattr="title" loccomment="Verb, end session">
Copyright (C) 2004, 2005 by Jarno Elonen
Released under the GNU General Public License version 2.