]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - po/at-expand.pl
Fix "make clean" so it removes all generated files in the scrub directory
[thirdparty/e2fsprogs.git] / po / at-expand.pl
CommitLineData
c0b7e799
TT
1#!/usr/bin/perl
2
7ae1983a
TT
3my @translator_help = (
4 "#. The strings in e2fsck's problem.c can be very hard to translate,\n",
5 "#. since the strings are expanded in two different ways. First of all,\n",
6 "#. there is an \@-expansion, where strings like \"\@i\" are expanded to\n",
7 "#. \"inode\", and so on. In order to make it easier for translators, the\n",
8 "#. e2fsprogs po template file has been enhanced with comments that show\n",
9 "#. the \@-expansion, for the strings in the problem.c file.\n",
10 "#.\n",
11 "#. Translators are free to use the \@-expansion facility if they so\n",
12 "#. choose, by providing translations for strings in e2fsck/message.c.\n",
13 "#. These translation can completely replace an expansion; for example,\n",
14 "#. if \"bblock\" (which indicated that \"\@b\" would be expanded to \"block\")\n",
15 "#. is translated as \"ddatenverlust\", then \"\@d\" will be expanded to\n",
16 "#. \"datenverlust\". Alternatively, translators can simply not use the\n",
17 "#. \@-expansion facility at all.\n",
18 "#.\n",
19 "#. The second expansion which is done for e2fsck's problem.c messages is\n",
20 "#. a dynamic %-expansion, which expands %i as an inode number, and so\n",
21 "#. on. A table of these expansions can be found below. Note that\n",
22 "#. %-expressions that begin with \"%D\" and \"%I\" are two-character\n",
23 "#. expansions; so for example, \"%Iu\" expands to the inode's user id\n",
0781e038
BS
24 "#. ownership field (inode->i_uid). Also the \"%B\" expansion is special:\n",
25 "#. it can expand to either the string \"indirect block\" (possibly preceded\n",
26 "#. by the word \"double\" or \"triple\"), or the string \"block #\" immediately\n",
27 "#. followed by an integer indicating a block sequence number.\n",
7ae1983a
TT
28 "#. \n",
29 "#. %b <blk> block number\n",
0781e038 30 "#. %B \"indirect block\" | \"block #\"<blkcount> string | string+integer\n",
7ae1983a
TT
31 "#. %c <blk2> block number\n",
32 "#. %Di <dirent> -> ino inode number\n",
33 "#. %Dn <dirent> -> name string\n",
34 "#. %Dr <dirent> -> rec_len\n",
35 "#. %Dl <dirent> -> name_len\n",
36 "#. %Dt <dirent> -> filetype\n",
37 "#. %d <dir> inode number\n",
38 "#. %g <group> integer\n",
39 "#. %i <ino> inode number\n",
40 "#. %Is <inode> -> i_size\n",
41 "#. %IS <inode> -> i_extra_isize\n",
42 "#. %Ib <inode> -> i_blocks\n",
43 "#. %Il <inode> -> i_links_count\n",
44 "#. %Im <inode> -> i_mode\n",
45 "#. %IM <inode> -> i_mtime\n",
46 "#. %IF <inode> -> i_faddr\n",
47 "#. %If <inode> -> i_file_acl\n",
578fcbfd 48 "#. %Id <inode> -> i_size_high\n",
7ae1983a
TT
49 "#. %Iu <inode> -> i_uid\n",
50 "#. %Ig <inode> -> i_gid\n",
1c97e615 51 "#. %It <str> file type\n",
7ae1983a
TT
52 "#. %j <ino2> inode number\n",
53 "#. %m <com_err error message>\n",
54 "#. %N <num>\n",
55 "#. %p ext2fs_get_pathname of directory <ino>\n",
56 "#. %P ext2fs_get_pathname of <dirent>->ino with <ino2> as\n",
57 "#. the containing directory. (If dirent is NULL\n",
58 "#. then return the pathname of directory <ino2>)\n",
59 "#. %q ext2fs_get_pathname of directory <dir>\n",
60 "#. %Q ext2fs_get_pathname of directory <ino> with <dir> as\n",
61 "#. the containing directory.\n",
62 "#. %s <str> miscellaneous string\n",
63 "#. %S backup superblock\n",
64 "#. %X <num> hexadecimal format\n",
65 "#.\n");
66
c0b7e799
TT
67my $is_problem_file = 0;
68my $save_msg;
69my $msg_accum = "";
70my $msg;
71my $expanded = 0;
7ae1983a 72my $lines = 0;
c0b7e799
TT
73
74sub do_expand {
75 $msg =~ s/\@a/extended attribute/g;
76 $msg =~ s/\@A/error allocating/g;
77 $msg =~ s/\@b/block/g;
78 $msg =~ s/\@B/bitmap/g;
79 $msg =~ s/\@c/compress/g;
80 $msg =~ s/\@C/conflicts with some other fs block/g;
81 $msg =~ s/\@i/inode/g;
82 $msg =~ s/\@I/illegal/g;
83 $msg =~ s/\@j/journal/g;
84 $msg =~ s/\@D/deleted/g;
85 $msg =~ s/\@d/directory/g;
86 $msg =~ s/\@e/entry/g;
87 $msg =~ s/\@E/entry '%Dn' in %p (%i)/g;
88 $msg =~ s/\@f/filesystem/g;
89 $msg =~ s/\@F/for inode %i (%Q) is/g;
90 $msg =~ s/\@g/group/g;
91 $msg =~ s/\@h/HTREE directory inode/g;
92 $msg =~ s/\@l/lost+found/g;
93 $msg =~ s/\@L/is a link/g;
7ae1983a
TT
94 $msg =~ s/\@m/multiply-claimed/g;
95 $msg =~ s/\@n/invalid/g;
c0b7e799
TT
96 $msg =~ s/\@o/orphaned/g;
97 $msg =~ s/\@p/problem in/g;
d4d03cd3 98 $msg =~ s/\@q/quota/g;
c0b7e799
TT
99 $msg =~ s/\@r/root inode/g;
100 $msg =~ s/\@s/should be/g;
101 $msg =~ s/\@S/superblock/g;
102 $msg =~ s/\@u/unattached/g;
103 $msg =~ s/\@v/device/g;
75b5672f 104 $msg =~ s/\@x/extent/g;
c0b7e799
TT
105 $msg =~ s/\@z/zero-length/g;
106 $msg =~ s/\@\@/@/g;
107}
108
109
110while (<>) {
7ae1983a
TT
111 $lines++;
112 if ($lines == 6) {
113 print @translator_help;
114 }
c0b7e799
TT
115 if (/^#: /)
116 {
117 $is_problem_file = (/^#: e2fsck\/problem/) ? 1 : 0;
118 }
119 $msg = "";
120 if (/^msgid / && $is_problem_file) {
121 ($msg) = /^msgid "(.*)"$/;
122 $save_msgid = $_;
123 if ($msg =~ /\@/) {
124 $expanded++;
125 }
126 &do_expand();
127 if ($msg ne "") {
7ae1983a 128 $msg_accum = $msg_accum . "#. \@-expanded: $msg\n";
c0b7e799
TT
129 }
130 next;
131 }
132 if (/^"/ && $is_problem_file) {
133 ($msg) = /^"(.*)"$/;
134 $save_msgid = $save_msgid . $_;
135 if ($msg =~ /\@/) {
136 $expanded++;
137 }
138 &do_expand();
7ae1983a 139 $msg_accum = $msg_accum . "#. \@-expanded: $msg\n";
c0b7e799
TT
140 next;
141 }
142 if (/^msgstr / && $is_problem_file) {
143 if ($expanded) {
144 print $msg_accum;
145 }
146 print $save_msgid;
147 $msg_accum = "";
148 $expanded = 0;
149 }
150 print $_;
151}