]> sipb.mit.edu Git - ikiwiki.git/commitdiff
po(cansave): use po_to_markup to check PO validity
authorintrigeri <intrigeri@boum.org>
Thu, 1 Jan 2009 21:16:43 +0000 (22:16 +0100)
committerintrigeri <intrigeri@boum.org>
Thu, 1 Jan 2009 21:16:43 +0000 (22:16 +0100)
Signed-off-by: intrigeri <intrigeri@boum.org>
IkiWiki/Plugin/po.pm

index 13110d24295154eba6908b2591601050d095cb6a..35e7c13fffa1622e2060f3a03c8a07b9c9b8ca44 100644 (file)
@@ -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 ($$$) {