5 Usage: genlang [-p=<prefix>] <language file>
7 When running this program. <prefix>.h and <prefix>.c will be created in the
8 "current directory". <prefix> is "lang" by default.
21 open(HFILE
, ">$prefix.h");
22 open(CFILE
, ">$prefix.c");
25 /* This file was automatically generated using genlang */
27 * The str() macro/functions is how to access strings that might be
28 * translated. Use it like str(MACRO) and expect a string to be
31 #define str(x) language_strings[x]
33 /* this is the array for holding the string pointers.
34 It will be initialized at runtime. */
35 extern unsigned char *language_strings[];
36 /* this contains the concatenation of all strings, separated by \0 chars */
37 extern const unsigned char language_builtin[];
39 /* The enum below contains all available strings */
45 /* This file was automaticly generated using genlang, the strings come
50 unsigned char *language_strings[LANG_LAST_INDEX_IN_ARRAY];
51 const unsigned char language_builtin[] =
55 open(LANG
, "<$input");
62 # get rid of DOS newlines
64 if($_ =~ / *([a-z]+): *(.*)/) {
65 ($var, $value) = ($1, $2);
66 # print "$var => $value\n";
70 if( (($var eq "new") && $value && ($value !~ /^\"(.*)\"\W*$/)) ||
71 (($var eq "voice") && $value && ($value !~ /^\"(.*)\"\W*$/)) ||
72 (($var eq "eng") && ($value !~ /^\"(.*)\"\W*$/)) ) {
73 print "$input:$line:missing quotes for ".$set{'id'}."\n";
79 # the last one for a single phrase
81 if(!$value || ($value eq "\"\"") ) {
82 # if not set, get the english version
85 # print "VOICE: ".$set{'voice'}." VALUE: $value\n";
86 # Note: if both entries are "", the string is deprecated,
87 # but must be included to maintain compatibility
88 if(($value eq "\"\"") && $set{'voice'} ne "\"\"") {
90 push @vfile, $set{'id'};
93 push @hfile, $set{'id'};
94 $value =~ s/\"$/\\0\"/;
95 print CFILE
" $value\n";
107 print HFILE
" $_,\n";
111 LANG_LAST_INDEX_IN_ARRAY, /* this is not a string, this is a marker */
112 /* --- below this follows voice-only strings --- */
113 VOICEONLY_DELIMITER = 0x8000,
118 print HFILE
" $_,\n";
123 /* end of generated enum list */
129 /* end of generated string list */