From c0b7e799bd0c46934468d5884c95dce73c80c769 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 9 May 2005 20:39:02 -0400 Subject: Modify the script which generates the e2fsprogs.pot translations template file to include comments that expand the '@' abbrevations in e2fsck/problem.c --- po/Makefile.in.in | 6 ++++- po/at-expand.pl | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 po/at-expand.pl (limited to 'po') diff --git a/po/Makefile.in.in b/po/Makefile.in.in index db658023..d242b295 100644 --- a/po/Makefile.in.in +++ b/po/Makefile.in.in @@ -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 index 00000000..59a20fd6 --- /dev/null +++ b/po/at-expand.pl @@ -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 $_; +} -- cgit v1.2.3