blob: 020136df5131435440c54ee18209841f40bba3c2 (
plain)
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
|
#!/usr/bin/perl
$engl = 1;
while(<>) {
chomp;
if(/^\s*$/) {
if($engl) {
next;
} else {
die "blank line mid-translation at $file, $.\n";
}
}
if($engl) {
$toTranslate = $_;
$engl = 0;
} else {
$translated = $_;
$toTranslate =~ s/\0/\\"/g;
$toTranslate =~ s#"##g;
$Already{$toTranslate} = 1;
$engl = 1;
}
}
# A tool to generate a list of strings to internationalize
for $file (<*.cpp>) {
open(IN, $file) or die;
$source = join("", <IN>);
close IN;
$source =~ s/\\"/\0/g;
while($source =~ m#
_\( \s*
((
\s* "
[^"]+
" \s*
)+)
\s*\)
#xsg) {
$str = $1;
$strIn = '';
while($str =~ m#\s*"([^"]+)"\s*#g) {
$strIn .= $1;
}
$Occurs{$strIn} = $c++;
$String{$strIn}++;
}
}
sub by_occurrence {
$Occurs{$a} <=> $Occurs{$b};
}
for (sort by_occurrence (keys %String)) {
if (not $Already{$_}) {
$_ =~ s/\0/\\"/g;
print qq{"$_"\n\n\n};
}
}
|