]>
Commit | Line | Data |
---|---|---|
c0b7e799 TT |
1 | #!/usr/bin/perl |
2 | ||
7ae1983a TT |
3 | my @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", | |
24 | "#. ownership field (inode->i_uid).\n", | |
25 | "#. \n", | |
26 | "#. %b <blk> block number\n", | |
27 | "#. %B <blkcount> integer\n", | |
28 | "#. %c <blk2> block number\n", | |
29 | "#. %Di <dirent> -> ino inode number\n", | |
30 | "#. %Dn <dirent> -> name string\n", | |
31 | "#. %Dr <dirent> -> rec_len\n", | |
32 | "#. %Dl <dirent> -> name_len\n", | |
33 | "#. %Dt <dirent> -> filetype\n", | |
34 | "#. %d <dir> inode number\n", | |
35 | "#. %g <group> integer\n", | |
36 | "#. %i <ino> inode number\n", | |
37 | "#. %Is <inode> -> i_size\n", | |
38 | "#. %IS <inode> -> i_extra_isize\n", | |
39 | "#. %Ib <inode> -> i_blocks\n", | |
40 | "#. %Il <inode> -> i_links_count\n", | |
41 | "#. %Im <inode> -> i_mode\n", | |
42 | "#. %IM <inode> -> i_mtime\n", | |
43 | "#. %IF <inode> -> i_faddr\n", | |
44 | "#. %If <inode> -> i_file_acl\n", | |
45 | "#. %Id <inode> -> i_dir_acl\n", | |
46 | "#. %Iu <inode> -> i_uid\n", | |
47 | "#. %Ig <inode> -> i_gid\n", | |
48 | "#. %j <ino2> inode number\n", | |
49 | "#. %m <com_err error message>\n", | |
50 | "#. %N <num>\n", | |
51 | "#. %p ext2fs_get_pathname of directory <ino>\n", | |
52 | "#. %P ext2fs_get_pathname of <dirent>->ino with <ino2> as\n", | |
53 | "#. the containing directory. (If dirent is NULL\n", | |
54 | "#. then return the pathname of directory <ino2>)\n", | |
55 | "#. %q ext2fs_get_pathname of directory <dir>\n", | |
56 | "#. %Q ext2fs_get_pathname of directory <ino> with <dir> as\n", | |
57 | "#. the containing directory.\n", | |
58 | "#. %s <str> miscellaneous string\n", | |
59 | "#. %S backup superblock\n", | |
60 | "#. %X <num> hexadecimal format\n", | |
61 | "#.\n"); | |
62 | ||
c0b7e799 TT |
63 | my $is_problem_file = 0; |
64 | my $save_msg; | |
65 | my $msg_accum = ""; | |
66 | my $msg; | |
67 | my $expanded = 0; | |
7ae1983a | 68 | my $lines = 0; |
c0b7e799 TT |
69 | |
70 | sub do_expand { | |
71 | $msg =~ s/\@a/extended attribute/g; | |
72 | $msg =~ s/\@A/error allocating/g; | |
73 | $msg =~ s/\@b/block/g; | |
74 | $msg =~ s/\@B/bitmap/g; | |
75 | $msg =~ s/\@c/compress/g; | |
76 | $msg =~ s/\@C/conflicts with some other fs block/g; | |
77 | $msg =~ s/\@i/inode/g; | |
78 | $msg =~ s/\@I/illegal/g; | |
79 | $msg =~ s/\@j/journal/g; | |
80 | $msg =~ s/\@D/deleted/g; | |
81 | $msg =~ s/\@d/directory/g; | |
82 | $msg =~ s/\@e/entry/g; | |
83 | $msg =~ s/\@E/entry '%Dn' in %p (%i)/g; | |
84 | $msg =~ s/\@f/filesystem/g; | |
85 | $msg =~ s/\@F/for inode %i (%Q) is/g; | |
86 | $msg =~ s/\@g/group/g; | |
87 | $msg =~ s/\@h/HTREE directory inode/g; | |
88 | $msg =~ s/\@l/lost+found/g; | |
89 | $msg =~ s/\@L/is a link/g; | |
7ae1983a TT |
90 | $msg =~ s/\@m/multiply-claimed/g; |
91 | $msg =~ s/\@n/invalid/g; | |
c0b7e799 TT |
92 | $msg =~ s/\@o/orphaned/g; |
93 | $msg =~ s/\@p/problem in/g; | |
94 | $msg =~ s/\@r/root inode/g; | |
95 | $msg =~ s/\@s/should be/g; | |
96 | $msg =~ s/\@S/superblock/g; | |
97 | $msg =~ s/\@u/unattached/g; | |
98 | $msg =~ s/\@v/device/g; | |
75b5672f | 99 | $msg =~ s/\@x/extent/g; |
c0b7e799 TT |
100 | $msg =~ s/\@z/zero-length/g; |
101 | $msg =~ s/\@\@/@/g; | |
102 | } | |
103 | ||
104 | ||
105 | while (<>) { | |
7ae1983a TT |
106 | $lines++; |
107 | if ($lines == 6) { | |
108 | print @translator_help; | |
109 | } | |
c0b7e799 TT |
110 | if (/^#: /) |
111 | { | |
112 | $is_problem_file = (/^#: e2fsck\/problem/) ? 1 : 0; | |
113 | } | |
114 | $msg = ""; | |
115 | if (/^msgid / && $is_problem_file) { | |
116 | ($msg) = /^msgid "(.*)"$/; | |
117 | $save_msgid = $_; | |
118 | if ($msg =~ /\@/) { | |
119 | $expanded++; | |
120 | } | |
121 | &do_expand(); | |
122 | if ($msg ne "") { | |
7ae1983a | 123 | $msg_accum = $msg_accum . "#. \@-expanded: $msg\n"; |
c0b7e799 TT |
124 | } |
125 | next; | |
126 | } | |
127 | if (/^"/ && $is_problem_file) { | |
128 | ($msg) = /^"(.*)"$/; | |
129 | $save_msgid = $save_msgid . $_; | |
130 | if ($msg =~ /\@/) { | |
131 | $expanded++; | |
132 | } | |
133 | &do_expand(); | |
7ae1983a | 134 | $msg_accum = $msg_accum . "#. \@-expanded: $msg\n"; |
c0b7e799 TT |
135 | next; |
136 | } | |
137 | if (/^msgstr / && $is_problem_file) { | |
138 | if ($expanded) { | |
139 | print $msg_accum; | |
140 | } | |
141 | print $save_msgid; | |
142 | $msg_accum = ""; | |
143 | $expanded = 0; | |
144 | } | |
145 | print $_; | |
146 | } |