]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - po/at-expand.pl
filefrag: fix issues with 29758d2
[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",
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",
1c97e615 48 "#. %It <str> file type\n",
7ae1983a
TT
49 "#. %j <ino2> inode number\n",
50 "#. %m <com_err error message>\n",
51 "#. %N <num>\n",
52 "#. %p ext2fs_get_pathname of directory <ino>\n",
53 "#. %P ext2fs_get_pathname of <dirent>->ino with <ino2> as\n",
54 "#. the containing directory. (If dirent is NULL\n",
55 "#. then return the pathname of directory <ino2>)\n",
56 "#. %q ext2fs_get_pathname of directory <dir>\n",
57 "#. %Q ext2fs_get_pathname of directory <ino> with <dir> as\n",
58 "#. the containing directory.\n",
59 "#. %s <str> miscellaneous string\n",
60 "#. %S backup superblock\n",
61 "#. %X <num> hexadecimal format\n",
62 "#.\n");
63
c0b7e799
TT
64my $is_problem_file = 0;
65my $save_msg;
66my $msg_accum = "";
67my $msg;
68my $expanded = 0;
7ae1983a 69my $lines = 0;
c0b7e799
TT
70
71sub do_expand {
72 $msg =~ s/\@a/extended attribute/g;
73 $msg =~ s/\@A/error allocating/g;
74 $msg =~ s/\@b/block/g;
75 $msg =~ s/\@B/bitmap/g;
76 $msg =~ s/\@c/compress/g;
77 $msg =~ s/\@C/conflicts with some other fs block/g;
78 $msg =~ s/\@i/inode/g;
79 $msg =~ s/\@I/illegal/g;
80 $msg =~ s/\@j/journal/g;
81 $msg =~ s/\@D/deleted/g;
82 $msg =~ s/\@d/directory/g;
83 $msg =~ s/\@e/entry/g;
84 $msg =~ s/\@E/entry '%Dn' in %p (%i)/g;
85 $msg =~ s/\@f/filesystem/g;
86 $msg =~ s/\@F/for inode %i (%Q) is/g;
87 $msg =~ s/\@g/group/g;
88 $msg =~ s/\@h/HTREE directory inode/g;
89 $msg =~ s/\@l/lost+found/g;
90 $msg =~ s/\@L/is a link/g;
7ae1983a
TT
91 $msg =~ s/\@m/multiply-claimed/g;
92 $msg =~ s/\@n/invalid/g;
c0b7e799
TT
93 $msg =~ s/\@o/orphaned/g;
94 $msg =~ s/\@p/problem in/g;
d4d03cd3 95 $msg =~ s/\@q/quota/g;
c0b7e799
TT
96 $msg =~ s/\@r/root inode/g;
97 $msg =~ s/\@s/should be/g;
98 $msg =~ s/\@S/superblock/g;
99 $msg =~ s/\@u/unattached/g;
100 $msg =~ s/\@v/device/g;
75b5672f 101 $msg =~ s/\@x/extent/g;
c0b7e799
TT
102 $msg =~ s/\@z/zero-length/g;
103 $msg =~ s/\@\@/@/g;
104}
105
106
107while (<>) {
7ae1983a
TT
108 $lines++;
109 if ($lines == 6) {
110 print @translator_help;
111 }
c0b7e799
TT
112 if (/^#: /)
113 {
114 $is_problem_file = (/^#: e2fsck\/problem/) ? 1 : 0;
115 }
116 $msg = "";
117 if (/^msgid / && $is_problem_file) {
118 ($msg) = /^msgid "(.*)"$/;
119 $save_msgid = $_;
120 if ($msg =~ /\@/) {
121 $expanded++;
122 }
123 &do_expand();
124 if ($msg ne "") {
7ae1983a 125 $msg_accum = $msg_accum . "#. \@-expanded: $msg\n";
c0b7e799
TT
126 }
127 next;
128 }
129 if (/^"/ && $is_problem_file) {
130 ($msg) = /^"(.*)"$/;
131 $save_msgid = $save_msgid . $_;
132 if ($msg =~ /\@/) {
133 $expanded++;
134 }
135 &do_expand();
7ae1983a 136 $msg_accum = $msg_accum . "#. \@-expanded: $msg\n";
c0b7e799
TT
137 next;
138 }
139 if (/^msgstr / && $is_problem_file) {
140 if ($expanded) {
141 print $msg_accum;
142 }
143 print $save_msgid;
144 $msg_accum = "";
145 $expanded = 0;
146 }
147 print $_;
148}