]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/po.pm
po(cansave): use po_to_markup to check PO validity
[ikiwiki.git] / 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);
 
 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 ($$$) {
 }
 
 sub canremove ($$$) {