From: intrigeri Date: Thu, 1 Jan 2009 21:16:43 +0000 (+0100) Subject: po(cansave): use po_to_markup to check PO validity X-Git-Url: https://scripts.mit.edu/gitweb/www/ikiwiki.git/commitdiff_plain/1d3da099b4763df37033e7955b8762f5b818d1b6 po(cansave): use po_to_markup to check PO validity Signed-off-by: intrigeri --- diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 13110d242..35e7c13ff 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -387,7 +387,15 @@ sub change(@) { sub cansave ($$$$) { my ($page, $content, $cgi, $session) = (shift, shift, shift, shift); - debug("po plugin running in cansave") + if (istranslation($page)) { + if (defined po_to_markup($page, $content, "nonfatal")) { + return undef; + } + else { + return "Could not parse this page's content; is this valid gettext?"; + } + } + return undef; } sub canremove ($$$) {