File tree Expand file tree Collapse file tree 1 file changed +17
-11
lines changed Expand file tree Collapse file tree 1 file changed +17
-11
lines changed Original file line number Diff line number Diff line change 1
1
# !/usr/bin/perl
2
2
3
+ use strict;
4
+
3
5
print <<EOT ;
4
6
// generated by txt2c.pl from $ARGV [0]
5
7
#include <stdlib.h>
6
8
EOT
7
9
8
- for $manual (<manual*txt>) {
10
+ my %manuals = map { / manual-?([^.]*)/ or die ; (lc ($1 ) || ' en' ) => $_ } glob (' manual*txt' );
11
+ my @languages_without_manual = grep { !exists $manuals {$_ } } map { / -([^.]*)/ or die ; lc $1 } glob (' lang-*.txt' );
9
12
10
- if ($manual eq ' manual.txt' ) {
11
- $name = " HelpText" ;
13
+ for my $lang (sort keys %manuals ) {
14
+ my ($name , $ifdef );
15
+ my $manual = $manuals {$lang };
16
+
17
+ if ($lang eq ' en' ) {
12
18
# Some languages don't have translated manuals yet, so use English
13
- $ifdef = " #if defined(LDLANG_EN) || defined(LDLANG_ES) || defined(LDLANG_IT) || " .
14
- " defined(LDLANG_PT)" ;
15
- } elsif ($manual =~ / manual-(.)(.)\. txt/ ) {
16
- $p = uc ($1 ) . lc ($2 );
17
- $ifdef = " #ifdef LDLANG_" . uc ($1 . $2 );
18
- $name = " HelpText$p " ;
19
+ my @langs = sort (' en' , @languages_without_manual );
20
+ my $cond = join ' || ' , map { " defined(LDLANG_$_ )" } map { uc } @langs ;
21
+
22
+ $name = " HelpText" ;
23
+ $ifdef = " #if $cond " ;
19
24
} else {
20
- die ;
25
+ $name = " HelpText" . ucfirst $lang ;
26
+ $ifdef = " #ifdef LDLANG_" . uc $lang ;
21
27
}
22
28
23
29
print <<EOT ;
29
35
while (<IN>) {
30
36
chomp ;
31
37
# avoid problem with Japanese encoding (cp932) which has 0x5c in a multibyte character
32
- s /\\ / \\\\ / g if $p ne ' Ja ' ;
38
+ s /\\ / \\\\ / g if $lang ne ' ja ' ;
33
39
s / "/ \\ "/ g ;
34
40
35
41
print qq{ "$_ ",\n } ;
You can’t perform that action at this time.
0 commit comments