summaryrefslogtreecommitdiffstats
path: root/po/bin/rm_text
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2007-06-07 18:54:11 +0000
committerThierry Vignaud <tv@mandriva.org>2007-06-07 18:54:11 +0000
commit534f2f4437093bd78411126ef45de41fc6b93bf3 (patch)
tree1a9c1e259e6f2495ebcacf3cbd8cb7d3fdaaac2a /po/bin/rm_text
parent92072c3be58f5c77ff0fecdaf6617fe6fa4120e1 (diff)
downloadbootloader-theme-534f2f4437093bd78411126ef45de41fc6b93bf3.tar
bootloader-theme-534f2f4437093bd78411126ef45de41fc6b93bf3.tar.gz
bootloader-theme-534f2f4437093bd78411126ef45de41fc6b93bf3.tar.bz2
bootloader-theme-534f2f4437093bd78411126ef45de41fc6b93bf3.tar.xz
bootloader-theme-534f2f4437093bd78411126ef45de41fc6b93bf3.zip
reimport my latest checkout
Diffstat (limited to 'po/bin/rm_text')
-rwxr-xr-xpo/bin/rm_text63
1 files changed, 63 insertions, 0 deletions
diff --git a/po/bin/rm_text b/po/bin/rm_text
new file mode 100755
index 0000000..9b96555
--- /dev/null
+++ b/po/bin/rm_text
@@ -0,0 +1,63 @@
+#! /usr/bin/perl
+
+# remove a text from *.po files
+
+sub drop;
+
+die "usage: rm_text id\n" if @ARGV != 1;
+
+$id = shift;
+$id = "txt_$id" unless $id =~ /^txt_/;
+
+mkdir old, 0755;
+
+for $f ("bootloader.pot", <*.po>) {
+ if(open F, $f) {
+ @f = <F>;
+ close F;
+
+ ( $new, $old ) = drop @f;
+ if(open F, ">>old/$f") {
+ print F @$old;
+ close F;
+
+ open F, ">$f";
+ print F @$new;
+ close F;
+ }
+ }
+}
+
+
+sub drop
+{
+ local $_;
+ my (@f, @g, $drop_it, @d);
+
+ for (@_) {
+ push @g, $_;
+ $drop_it = 1 if /^#\.\s*${id}\s*$/;
+ if(/^\s*$/) {
+ if($drop_it) {
+ push @d, @g;
+ }
+ else {
+ push @f, @g;
+ }
+ undef $drop_it;
+ undef @g;
+ }
+ }
+
+ if(@g) {
+ if($drop_it) {
+ push @d, @g;
+ }
+ else {
+ push @f, @g;
+ }
+ }
+
+ return ( \@f, \@d );
+}
+