From: intrigeri <intrigeri@boum.org>
Date: Thu, 13 Nov 2008 00:38:22 +0000 (+0100)
Subject: po(delete): added hook, and function skeleton
X-Git-Tag: 3.15~326
X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/c390056eb2b99bcc3a528611f5a9fde79ea364cf?ds=sidebyside;hp=--cc

po(delete): added hook, and function skeleton

Not implemented yet, 'cos the renamepage hook has to come first.
Else translations would be deleted on rename, what a shame.

Signed-off-by: intrigeri <intrigeri@boum.org>
---

c390056eb2b99bcc3a528611f5a9fde79ea364cf
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index d92443b18..60a9f2632 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -35,6 +35,7 @@ sub import { #{{{
 	hook(type => "filter", id => "po", call => \&filter);
 	hook(type => "htmlize", id => "po", call => \&htmlize);
 	hook(type => "pagetemplate", id => "po", call => \&pagetemplate, last => 1);
+	hook(type => "delete", id => "po", call => \&mydelete);
 	hook(type => "change", id => "po", call => \&change);
 	hook(type => "editcontent", id => "po", call => \&editcontent);
 
@@ -325,6 +326,12 @@ sub pagetemplate (@) { #{{{
 	}
 } # }}}
 
+sub mydelete(@) { #{{{
+	my @deleted=@_;
+
+	map { deletetranslations($_) } grep istranslatablefile($_), @deleted;
+} #}}}
+
 sub change(@) { #{{{
 	my @rendered=@_;
 
@@ -757,6 +764,13 @@ sub homepageurl (;$) { #{{{
 	return urlto('', $page);
 } #}}}
 
+# do *not* implement this until the renamepage hook works
+sub deletetranslations ($) { #{{{
+	my $file=shift;
+
+	debug 'po(deletetranslations): TODO: delete translations of ' . $file;
+} #}}}
+
 # ,----
 # | PageSpec's
 # `----