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 with all the strings */
34 extern unsigned char *language_strings[];
36 /* The enum below contains all available strings */
42 /* This file was automaticly generated using genlang, the strings come
45 unsigned char *language_strings[]={
49 open(LANG
, "<$input");
56 # get rid of DOS newlines
58 if($_ =~ / *([a-z]+): *(.*)/) {
59 ($var, $value) = ($1, $2);
60 # print "$var => $value\n";
64 if( (($var eq "new") && $value && ($value !~ /^\"(.*)\"\W*$/)) ||
65 (($var eq "voice") && $value && ($value !~ /^\"(.*)\"\W*$/)) ||
66 (($var eq "eng") && ($value !~ /^\"(.*)\"\W*$/)) ) {
67 print "$input:$line:missing quotes for ".$set{'id'}."\n";
73 # the last one for a single phrase
75 if(!$value || ($value eq "\"\"") ) {
76 # if not set, get the english version
79 # print "VOICE: ".$set{'voice'}." VALUE: $value\n";
80 # Note: if both entries are "", the string is deprecated,
81 # but must be included to maintain compatibility
82 if(($value eq "\"\"") && $set{'voice'} ne "\"\"") {
84 push @vfile, $set{'id'};
87 push @hfile, $set{'id'};
88 print CFILE
" $value,\n";
100 print HFILE
" $_,\n";
103 print HFILE
" /* --- below this follows voice-only strings --- */\n",
104 " VOICEONLY_DELIMITER = 0x8000,\n";
107 print HFILE
" $_,\n";
111 LANG_LAST_INDEX_IN_ARRAY /* this is not a string, this is a marker */
113 /* end of generated enum list */
119 /* end of generated string list */