Whamcloud - gitweb
Modify the script which generates the e2fsprogs.pot translations template
authorTheodore Ts'o <tytso@mit.edu>
Tue, 10 May 2005 00:39:02 +0000 (20:39 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 10 May 2005 00:39:02 +0000 (20:39 -0400)
file to include comments that expand the '@' abbrevations in e2fsck/problem.c

po/Makefile.in.in
po/at-expand.pl [new file with mode: 0644]

index db65802..d242b29 100644 (file)
@@ -105,6 +105,9 @@ $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
          --files-from=$(srcdir)/POTFILES.in \
          --copyright-holder='$(COPYRIGHT_HOLDER)' \
          --msgid-bugs-address='$(MSGID_BUGS_ADDRESS)'
+       perl $(srcdir)/at-expand.pl < $(DOMAIN).po > $(DOMAIN).po.new
+       mv $(DOMAIN).po $(DOMAIN).po.bak
+       mv $(DOMAIN).po.new $(DOMAIN).po
        test ! -f $(DOMAIN).po || { \
          if test -f $(srcdir)/$(DOMAIN).pot; then \
            sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
@@ -269,9 +272,10 @@ check: all
 info dvi ps pdf html tags TAGS ctags CTAGS ID:
 
 mostlyclean:
-       rm -f remove-potcdate.sed
+       rm -f remove-potcdate.sed 
        rm -f stamp-poT
        rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
+       rm -f $(DOMAIN).po.bak
        rm -fr *.o
 
 clean: mostlyclean
diff --git a/po/at-expand.pl b/po/at-expand.pl
new file mode 100644 (file)
index 0000000..59a20fd
--- /dev/null
@@ -0,0 +1,78 @@
+#!/usr/bin/perl
+
+my $is_problem_file = 0;
+my $save_msg;
+my $msg_accum = "";
+my $msg;
+my $expanded = 0;
+
+sub do_expand {
+    $msg =~ s/\@a/extended attribute/g;
+    $msg =~ s/\@A/error allocating/g;
+    $msg =~ s/\@b/block/g;
+    $msg =~ s/\@B/bitmap/g;
+    $msg =~ s/\@c/compress/g;
+    $msg =~ s/\@C/conflicts with some other fs block/g;
+    $msg =~ s/\@i/inode/g;
+    $msg =~ s/\@I/illegal/g;
+    $msg =~ s/\@j/journal/g;
+    $msg =~ s/\@D/deleted/g;
+    $msg =~ s/\@d/directory/g;
+    $msg =~ s/\@e/entry/g;
+    $msg =~ s/\@E/entry '%Dn' in %p (%i)/g;
+    $msg =~ s/\@f/filesystem/g;
+    $msg =~ s/\@F/for inode %i (%Q) is/g;
+    $msg =~ s/\@g/group/g;
+    $msg =~ s/\@h/HTREE directory inode/g;
+    $msg =~ s/\@l/lost+found/g;
+    $msg =~ s/\@L/is a link/g;
+    $msg =~ s/\@o/orphaned/g;
+    $msg =~ s/\@p/problem in/g;
+    $msg =~ s/\@r/root inode/g;
+    $msg =~ s/\@s/should be/g;
+    $msg =~ s/\@S/superblock/g;
+    $msg =~ s/\@u/unattached/g;
+    $msg =~ s/\@v/device/g;
+    $msg =~ s/\@z/zero-length/g;
+    $msg =~ s/\@\@/@/g;
+}
+
+
+while (<>) {
+    if (/^#: /)
+    {
+       $is_problem_file = (/^#: e2fsck\/problem/) ? 1 : 0;
+    }
+    $msg = "";
+    if (/^msgid / && $is_problem_file) {
+       ($msg) = /^msgid "(.*)"$/;
+       $save_msgid = $_;
+       if ($msg =~ /\@/) {
+           $expanded++;
+       }
+       &do_expand();
+       if ($msg ne "") {
+           $msg_accum = $msg_accum . "#. \@-expand: $msg\n";
+       }
+       next;
+    }
+    if (/^"/ && $is_problem_file) {
+       ($msg) = /^"(.*)"$/;
+       $save_msgid = $save_msgid . $_;
+       if ($msg =~ /\@/) {
+           $expanded++;
+       }
+       &do_expand();
+       $msg_accum = $msg_accum . "#. \@-expand: $msg\n";
+       next;
+    }
+    if (/^msgstr / && $is_problem_file) {
+       if ($expanded) {
+           print $msg_accum;
+       }
+       print $save_msgid;
+       $msg_accum = "";
+       $expanded = 0;
+    }
+    print $_;
+}