From: Geoffrey T. D. <da...@us...> - 2001-12-16 18:33:27
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory usw-pr-cvs1:/tmp/cvs-serv13266/lib Modified Files: WikiPlugin.php diff.php loadsave.php main.php stdlib.php Log Message: Refactor $WikiPlugin::name and $WikiPlugin::description stuff. It is best if all calls to gettext have constant, double-quoted strings as their arguments. (Otherwise xgettext won't find the strings for translation.) Also, a few other gettext cleanups. Index: WikiPlugin.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/WikiPlugin.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** WikiPlugin.php 2001/12/16 11:52:35 1.5 --- WikiPlugin.php 2001/12/16 18:33:25 1.6 *************** *** 15,24 **** } function getName() { ! return gettext($this->name); } function getDescription() { ! return gettext($this->description); } --- 15,39 ---- } + /** + * Get name of plugin. + * + * This is used (by default) by getDefaultLinkArguments and + * getDefaultFormArguments to compute the default link/form + * targets. + * + * If you want to gettextify the name (probably a good idea), + * override this method in your plugin class, like: + * <pre> + * function getName() { return _("MyPlugin"); } + * </pre> + * + * @return string plugin name/target. + */ function getName() { ! return preg_replace('/^.*_/', '', get_class($this)); } function getDescription() { ! return $this->getName(); } Index: diff.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/diff.php,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** diff.php 2001/12/15 02:40:42 1.20 --- diff.php 2001/12/16 18:33:25 1.21 *************** *** 170,183 **** $linked_version = QElement('a', array('href' => $url), $rev->getVersion()); $cols .= Element('td', ! gettext("version") . " " . $linked_version); $cols .= QElement('td', ! sprintf(gettext ("last modified on %s"), strftime($datetimeformat, $rev->get('mtime')))); $cols .= QElement('td', ! sprintf(gettext ("by %s"), $rev->get('author'))); } else { ! $cols .= QElement('td', array('colspan' => '3'), ! gettext ("None")); } return Element('tr', $cols); --- 170,182 ---- $linked_version = QElement('a', array('href' => $url), $rev->getVersion()); $cols .= Element('td', ! _("version") . " " . $linked_version); $cols .= QElement('td', ! sprintf(_("last modified on %s"), strftime($datetimeformat, $rev->get('mtime')))); $cols .= QElement('td', ! sprintf(_("by %s"), $rev->get('author'))); } else { ! $cols .= QElement('td', array('colspan' => '3'), _("None")); } return Element('tr', $cols); *************** *** 200,208 **** if (!($new = $page->getRevision($version))) NoSuchRevision($page, $version); ! $new_version = sprintf(gettext("version %d"), $version); } else { $new = $page->getCurrentRevision(); ! $new_version = gettext('current version'); } --- 199,207 ---- if (!($new = $page->getRevision($version))) NoSuchRevision($page, $version); ! $new_version = sprintf(_("version %d"), $version); } else { $new = $page->getCurrentRevision(); ! $new_version = _("current version"); } *************** *** 210,214 **** if ( !($old = $page->getRevision($previous)) ) NoSuchRevision($page, $previous); ! $old_version = sprintf(gettext("version %d"), $previous); $others = array('major', 'minor', 'author'); } --- 209,213 ---- if ( !($old = $page->getRevision($previous)) ) NoSuchRevision($page, $previous); ! $old_version = sprintf(_("version %d"), $previous); $others = array('major', 'minor', 'author'); } *************** *** 221,225 **** break; } ! $old_version = gettext("previous major revision"); $others = array('minor', 'author'); break; --- 220,224 ---- break; } ! $old_version = _("previous major revision"); $others = array('minor', 'author'); break; *************** *** 230,234 **** break; } ! $old_version = gettext("revision by previous author"); $others = array('major', 'minor'); break; --- 229,233 ---- break; } ! $old_version = _("revision by previous author"); $others = array('major', 'minor'); break; *************** *** 237,241 **** $previous='minor'; $old = $page->getRevisionBefore($new); ! $old_version = gettext("previous revision"); $others = array('major', 'author'); break; --- 236,240 ---- $previous='minor'; $old = $page->getRevisionBefore($new); ! $old_version = _("previous revision"); $others = array('major', 'author'); break; *************** *** 250,260 **** $html = Element('p', ! sprintf(htmlspecialchars(gettext("Differences between %s and %s of %s.")), $new_link, $old_link, $page_link)); $otherdiffs=''; ! $label = array('major' => gettext("Previous Major Revision"), ! 'minor' => gettext("Previous Revision"), ! 'author'=> gettext("Previous Author")); foreach ($others as $other) { $args = array('action' => 'diff', 'previous' => $other); --- 249,259 ---- $html = Element('p', ! sprintf(htmlspecialchars(_("Differences between %s and %s of %s.")), $new_link, $old_link, $page_link)); $otherdiffs=''; ! $label = array('major' => _("Previous Major Revision"), ! 'minor' => _("Previous Revision"), ! 'author'=> _("Previous Author")); foreach ($others as $other) { $args = array('action' => 'diff', 'previous' => $other); *************** *** 266,270 **** } $html .= Element('p', ! htmlspecialchars(gettext("Other diffs:")) . $otherdiffs); --- 265,269 ---- } $html .= Element('p', ! htmlspecialchars(_("Other diffs:")) . $otherdiffs); *************** *** 274,279 **** $html .= Element('table', ! PageInfoRow($pagename, gettext ("Newer page:"), $new) ! . PageInfoRow($pagename, gettext ("Older page:"), $old)); --- 273,278 ---- $html .= Element('table', ! PageInfoRow($pagename, _("Newer page:"), $new) ! . PageInfoRow($pagename, _("Older page:"), $old)); *************** *** 283,287 **** if ($diff->isEmpty()) { $html .= Element('hr'); ! $html .= QElement('p', '[' . gettext ("Versions are identical") . ']'); } else { --- 282,286 ---- if ($diff->isEmpty()) { $html .= Element('hr'); ! $html .= QElement('p', '[' . _("Versions are identical") . ']'); } else { *************** *** 297,301 **** include_once('lib/Template.php'); echo GeneratePage('MESSAGE', $html, ! sprintf(gettext ("Diff: %s"), $pagename)); } --- 296,300 ---- include_once('lib/Template.php'); echo GeneratePage('MESSAGE', $html, ! sprintf(_("Diff: %s"), $pagename)); } Index: loadsave.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/loadsave.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** loadsave.php 2001/12/14 22:17:24 1.15 --- loadsave.php 2001/12/16 18:33:25 1.16 *************** *** 414,418 **** StartLoadDump("Loading '$source'"); echo "<dl>\n"; ! LoadAny($dbi, $source/*, false, array(gettext('RecentChanges'))*/); echo "</dl>\n"; EndLoadDump(); --- 414,418 ---- StartLoadDump("Loading '$source'"); echo "<dl>\n"; ! LoadAny($dbi, $source/*, false, array(gettext("RecentChanges"))*/); echo "</dl>\n"; EndLoadDump(); *************** *** 450,454 **** $fd = $upload->open(); if (IsZipFile($fd)) ! LoadZip($dbi, $fd, false, array(gettext('RecentChanges'))); else Loadfile($dbi, $upload->getName(), $upload->getContents()); --- 450,454 ---- $fd = $upload->open(); if (IsZipFile($fd)) ! LoadZip($dbi, $fd, false, array(_("RecentChanges"))); else Loadfile($dbi, $upload->getName(), $upload->getContents()); Index: main.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/main.php,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** main.php 2001/12/14 20:28:02 1.20 --- main.php 2001/12/16 18:33:25 1.21 *************** *** 118,125 **** // FIXME: this whole section should probably be deleted. if ($request->getArg('searchtype') == 'full') { ! $search_page = gettext('FullTextSearch'); } else { ! $search_page = gettext('TitleSearch'); } $request->redirect(WikiURL($search_page, --- 118,125 ---- // FIXME: this whole section should probably be deleted. if ($request->getArg('searchtype') == 'full') { ! $search_page = _("FullTextSearch"); } else { ! $search_page = _("TitleSearch"); } $request->redirect(WikiURL($search_page, Index: stdlib.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/stdlib.php,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -r1.59 -r1.60 *** stdlib.php 2001/12/12 23:51:25 1.59 --- stdlib.php 2001/12/16 18:33:25 1.60 *************** *** 128,132 **** return Element('strong', QElement('u', array('class' => 'baduri'), ! _('BAD URL -- remove all of <, >, "'))); //" } --- 128,132 ---- return Element('strong', QElement('u', array('class' => 'baduri'), ! _("BAD URL -- remove all of <, >, \""))); //" } *************** *** 334,338 **** if (!$page->get('locked')) return QElement('u', array('class' => 'wikiunsafe'), ! gettext('Lock page to enable link')); $class = 'wikiadmin'; --- 334,338 ---- if (!$page->get('locked')) return QElement('u', array('class' => 'wikiunsafe'), ! _("Lock page to enable link")); $class = 'wikiadmin'; |