summaryrefslogtreecommitdiffstats
path: root/po/bin/rm_text
diff options
context:
space:
mode:
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 );
+}
+