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