Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
expimp.cpp
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19//
20// expimp.cpp
21//
22
23#include "stdAfx.h"
24#include "transDB.h"
25#include "XLStuff.h"
26#include "Babylondlg.h"
27#include "VerifyTextDlg.h"
28#include "Babylon.h"
29#include "expimp.h"
30#include "direct.h"
31#include "fileops.h"
32#include "olestring.h"
33
34static char buffer[100*1024];
35static char buffer2[100*1024];
36static OLECHAR olebuf[100*1024];
37static OLECHAR olebuf2[100*1024];
38static OLECHAR oletrans[100*1024];
39
40static CBabylonDlg *progress_dlg;
41static int progress_count;
42
43static void progress_cb ( void )
44{
45 progress_count ++;
46
47 if ( progress_dlg )
48 {
49 progress_dlg->SetProgress ( progress_count );
50 }
51}
52
53static FILE *cb_file;
54
55static void print_to_file ( const char *text )
56{
57
58 fprintf ( cb_file, "\t\t\tString %s\n", text );
59
60}
61
62static void reverseWord ( OLECHAR *fp, OLECHAR *lp )
63{
64 int first = TRUE;
65 OLECHAR f, l;
66
67 while ( TRUE )
68 {
69 if ( fp >= lp )
70 {
71 return;
72 }
73
74 f = *fp;
75 l = *lp;
76
77 if ( first )
78 {
79 if ( f >= 'A' && f <= 'Z' )
80 {
81 if ( l >= 'a' && l <= 'z' )
82 {
83 f = (f - 'A') + 'a';
84 l = (l - 'a') + 'A';
85 }
86 }
87
88 first = FALSE;
89 }
90
91 *lp-- = f;
92 *fp++ = l;
93
94 }
95
96}
97
98
99static void translateCopy( OLECHAR *outbuf, OLECHAR *inbuf )
100{
101 int slash = FALSE;
102
103 {
104 static OLECHAR buffer[100*1024];
105 OLECHAR *firstLetter = NULL, *lastLetter;
106 OLECHAR *b = buffer;
107 int formatWord = FALSE;
108 OLECHAR ch;
109
110 while ( (ch = *inbuf++))
111 {
112 if ( ! (( ch >= 'a' && ch <= 'z') || ( ch >= 'A' && ch <= 'Z' )))
113 {
114 if ( firstLetter )
115 {
116 if ( !formatWord )
117 {
118 lastLetter = b-1;
119 reverseWord ( firstLetter, lastLetter );
120 }
121 firstLetter = NULL;
122 formatWord = FALSE;
123 }
124 *b++ = ch;
125 if ( ch == '\\' )
126 {
127 *b++ = *inbuf++;
128 }
129 if ( ch == '%' )
130 {
131 while ( (ch = *inbuf++) && !IsFormatTypeChar ( ch ) && ch != '%')
132 {
133 *b++ = ch;
134 }
135 *b++ = ch;
136 }
137 }
138 else
139 {
140 if ( !firstLetter )
141 {
142 firstLetter = b;
143 }
144
145 *b++ = ch;
146
147 }
148 }
149
150 if ( firstLetter )
151 {
152 lastLetter = b-1;
153 reverseWord ( firstLetter, lastLetter );
154 }
155
156 *b++ = 0;
157 inbuf = buffer;
158
159 }
160
161
162
163 while( *inbuf != '\0' )
164 {
165
166 *outbuf++ = *inbuf++;
167 }
168 *outbuf= 0;
169}
170
171
172static void writeLabel ( BabylonLabel *label, int row )
173{
174 PutCell ( row, CELL_LABEL, label->Name (), 0);
175 wcscpy ( olebuf, label->Comment());
176 EncodeFormat ( olebuf );
177 PutCell ( row, CELL_COMMENT, olebuf, 0);
178 wcscpy ( olebuf, label->Context());
179 EncodeFormat ( olebuf );
180 PutCell ( row, CELL_CONTEXT, olebuf, 0);
181 wcscpy ( olebuf, label->Speaker());
182 EncodeFormat ( olebuf );
183 PutCell ( row, CELL_SPEAKER, olebuf, 0);
184 wcscpy ( olebuf, label->Listener());
185 EncodeFormat ( olebuf );
186 PutCell ( row, CELL_LISTENER, olebuf , 0);
187}
188
189static void writeText ( BabylonText *text, int row )
190{
191 BabylonLabel *label = text->Label ();
192 int maxlen = label->MaxLen ();
193 OLECHAR buffer[100];
194
195 if ( !maxlen )
196 {
197 maxlen = 10000;
198 }
199
200 wcscpy ( olebuf, text->Get());
201 EncodeFormat ( olebuf );
202 PutCell ( row, CELL_ENGLISH, olebuf , 0);
203 PutCell ( row, CELL_MAXLEN, NULL , maxlen );
204
205 swprintf ( buffer, L"=LEN(%c%d)",'A' + CELL_LOCALIZED -1, row );
206 PutCell ( row, CELL_STRLEN, buffer , 0);
207 swprintf ( buffer, L"=IF(%c%d>%c%d,\"Too long!\",\" \")", 'A' + CELL_STRLEN -1, row, 'A' + CELL_MAXLEN -1, row );
208 PutCell ( row, CELL_LENCHECK ,buffer , 0);
209 PutCell ( row, CELL_REVISION , 0, text->Revision ());
210 PutCell ( row, CELL_STRINGID , 0, text->ID ());
211
212 writeLabel ( label, row );
213}
214
215static int export_trans ( TransDB *db, LangID langid, TROPTIONS *options, void (*cb) (void ), int write )
216{
218 BabylonText *text;
219 Translation *trans;
220 ListSearch sh_label, sh_text;
221 int count = 0;
222 int limit = FALSE;
223 int all = TRUE;
224 int row;
225 LANGINFO *linfo;
226
227 linfo = GetLangInfo ( langid );
228
229 if ( options->filter == TR_SAMPLE )
230 {
231 limit = TRUE;
232 }
233 else if ( options->filter == TR_CHANGES )
234 {
235 all = FALSE;
236 }
237
238 if ( write )
239 {
240 OLECHAR buffer[100];
241
242 swprintf ( buffer, L"%S", GetLangName ( langid ));
244
245 swprintf ( buffer, L"%S Translation", GetLangName ( langid ));
246 PutCell ( 2, CELL_LOCALIZED,buffer,0);
247 }
248
249 row = 3;
250 label = db->FirstLabel ( sh_label );
251
252 while ( label )
253 {
254 int label_written = FALSE;
255 text = label->FirstText ( sh_text );
256
257 while ( text )
258 {
259 int export;
260 int bad_format = FALSE;
261 int too_long = FALSE;
262
263 trans = text->GetTranslation ( langid );
264
265 if ( options->filter == TR_UNSENT )
266 {
267 export = !text->IsSent ();
268 }
269 else if ( options->filter == TR_NONDIALOG )
270 {
271 export = !text->IsDialog ();
272 }
273 else if ( options->filter == TR_UNVERIFIED )
274 {
275 export = text->IsDialog() && text->DialogIsPresent( DialogPath, langid) && !text->DialogIsValid( DialogPath, langid);
276 }
277 else if ( options->filter == TR_MISSING_DIALOG )
278 {
279 export = text->IsDialog() && !text->DialogIsPresent( DialogPath, langid);
280 }
281 else if ( options->filter == TR_DIALOG )
282 {
283 export = text->IsDialog ();
284 }
285 else
286 {
287 if ( ! (export = all) )
288 {
289 if ( !trans )
290 {
291 export = TRUE;
292 }
293 else
294 {
295 if ( text->Revision () > trans->Revision ())
296 {
297 export = TRUE;
298 }
299 else if ( trans->TooLong ( label->MaxLen ()) )
300 {
301 export = TRUE;
302 too_long = TRUE;
303 }
304 else if ( !trans->ValidateFormat ( text ) )
305 {
306 export = TRUE;
307 bad_format = TRUE;
308 }
309 }
310 }
311 }
312
313 if ( export && text->Len () )
314 {
315 count++;
316 if ( cb )
317 {
318 cb ();
319 }
320
321 if ( write )
322 {
323 static OLECHAR buffer[100*1024];
324
325 if ( !label_written )
326 {
327 // write out the lable
328 //PutSeparator ( row++ );
329 //writeLabel ( label, row );
330 label_written = TRUE;
331 }
332
333 // write out text
334 writeText ( text, row );
335 if ( text->IsDialog ())
336 {
337 swprintf ( buffer, L"%s%S.wav", text->Wave (), linfo->character );
338 wcsupr ( buffer );
339 PutCell ( row, CELL_WAVEFILE , buffer, 0);
340 }
341
342 {
343 Translation *trans = text->GetTranslation ( langid );
344
345 if ( langid == LANGID_JABBER || (trans && ( options->include_translations || too_long || bad_format )))
346 {
347
348 if ( langid == LANGID_JABBER )
349 {
350 translateCopy ( olebuf, text->Get() );
351 }
352 else
353 {
354 wcscpy ( olebuf, trans->Get());
355 }
356
357 EncodeFormat ( olebuf );
358 PutCell ( row, CELL_LOCALIZED, olebuf, 0);
359 if ( bad_format || too_long)
360 {
361 wcscpy ( olebuf, L"ERROR: " );
362 if ( too_long )
363 {
364 wcscat ( olebuf, L"too long" );
365 if ( bad_format )
366 {
367 wcscat ( olebuf, L"and " );
368 }
369 }
370
371 if ( bad_format )
372 {
373 wcscat ( olebuf, L"bad format" );
374 }
375
376 PutCell ( row, CELL_COMMENT, olebuf , 0);
377 }
378 }
379 }
380 row++;
381 }
382 }
383
384 text = label->NextText ( sh_text );
385 }
386
387 if ( limit && count > 50 )
388 {
389 break;
390 }
391
392 label = db->NextLabel ( sh_label );
393 }
394
395 if ( write )
396 {
397 PutCell ( row, CELL_STRINGID, NULL, -1 );
398 PutCell ( ROW_COUNT, COLUMN_COUNT, NULL, count );
399 }
400
401 return count;
402}
403
404
405int ExportTranslations ( TransDB *db, const char *filename, LangID langid, TROPTIONS *options, CBabylonDlg *dlg )
406{
407 int exports ;
408 exports = export_trans ( db, langid, options, NULL, FALSE );
409
410 if ( !exports )
411 {
412 if ( dlg )
413 {
414 AfxMessageBox ( "Nothing to export." );
415 dlg->Ready ();
416 }
417
418 return 0;
419 }
420
421 if ( (progress_dlg = dlg) )
422 {
423 char *format;
424 dlg->InitProgress ( exports );
425
426 dlg->Log ("");
427
428 switch (options->filter )
429 {
430 case TR_ALL:
431 format = "Exporting all strings";
432 break;
433 case TR_CHANGES:
434 format = "Exporting all strings that require %s translation";
435 break;
436 case TR_SAMPLE:
437 format = "Exporting a sample %s translation file";
438 break;
439 case TR_DIALOG:
440 format = "Exporting dialog only %s translation file";
441 break;
442 case TR_NONDIALOG:
443 format = "Exporting non-dialog %s translation file";
444 break;
445 case TR_UNVERIFIED:
446 format = "Exporting all unverified %s dialog";
447 break;
449 format = "Exporting all missing %s dialog";
450 break;
451
452
453 default:
454 format = "Undefined switch";
455 break;
456
457
458 }
459 strcpy ( buffer2, format );
460 if ( options->include_comments && options->include_translations )
461 {
462 strcat ( buffer2, " with current %s translations and translator comments" );
463 }
464 else if ( options->include_comments )
465 {
466 strcat ( buffer2, " with %s translator comments" );
467 }
468 else if ( options->include_translations )
469 {
470 strcat ( buffer2, " with current %s translations" );
471 }
472 strcat ( buffer2, "..." );
473 sprintf ( buffer, buffer2, GetLangName ( langid ), GetLangName ( langid ) );
474 dlg->Status ( buffer );
475 }
476
477 _getcwd ( buffer, sizeof ( buffer ) -1 );
478
479 strcat ( buffer, "\\babylon.xlt" );
480
481 if ( !FileExists ( buffer ) )
482 {
483 if ( dlg )
484 {
485 dlg->Log ("FAILED", SAME_LINE );
486 sprintf ( buffer2, "Template file \"%s\" is missing. Cannot export.", buffer );
487 AfxMessageBox ( buffer2 );
488 dlg->Log ( buffer2 );
489 dlg->Ready();
490 }
491 return -1;
492 }
493
494 progress_count = 0;
495 exports = -1;
496
497 if ( NewWorkBook ( buffer ) )
498 {
499 if ( (exports = export_trans ( db, langid, options, progress_cb, TRUE )) != -1 )
500 {
501 if ( SaveWorkBook ( filename, TRUE ) )
502 {
503 if ( dlg )
504 {
505 dlg->Log ("DONE", SAME_LINE );
506 }
507 }
508 else
509 {
510 if ( dlg )
511 {
512 dlg->Log ("FAILED", SAME_LINE );
513 sprintf ( buffer2, "Failed to save export!");
514 AfxMessageBox ( buffer2 );
515 dlg->Log ( buffer2 );
516 }
517 exports = -1;
518 }
519 }
520 CloseWorkBook ( );
521 }
522 else
523 {
524 if ( dlg )
525 {
526 dlg->Log ("FAILED", SAME_LINE );
527 sprintf ( buffer2, "Failed to create new work book. File \"%s\" may be corrupt", buffer );
528 AfxMessageBox ( buffer2 );
529 dlg->Log ( buffer2 );
530 }
531 }
532
533 if ( dlg )
534 {
535 dlg->Ready();
536 }
537
538 return exports;
539}
540
541
542static int import_trans ( TransDB *db, LangID langid, void (*cb) ( void ), CBabylonDlg *dlg )
543{
544 int row = 3;
545 int id;
546 int count = 0;
547 int new_count = 0;
548 int changes_count = 0;
549 int missing_count = 0;
550 int mismatch_count = 0;
551 int stale_count = 0;
552 int first_mismatch = TRUE;
553 int bad_id = FALSE;
554 int error_count = 0;
555 int revision;
556
557 while ( (id = GetInt ( row, CELL_STRINGID )) != -1)
558 {
559 if ( id == 0 )
560 {
561 goto skip;
562 }
563
564 BabylonText *text;
565
566 if ( (text = db->FindText ( id )) == NULL )
567 {
568 // string is no longer in database
569 stale_count++;
570 goto next;
571 }
572
573 revision = GetInt ( row, CELL_REVISION );
574
575 if ( text->Revision() > revision )
576 {
577 // old translation
578 stale_count++;
579 goto next;
580 }
581
582 if ( text->Revision() < revision )
583 {
584 if ( dlg )
585 {
586 sprintf ( buffer, "ERROR: expecting revision %d for string ID %d but found revision %d. Possible bad ID!", text->Revision (), id, revision );
587 dlg->Log ( buffer );
588 }
589 error_count++;
590 goto next;
591 }
592
593 // first see if there is any translation there
594 GetString ( row, CELL_LOCALIZED, oletrans );
595 DecodeFormat ( oletrans );
596
597 if ( !oletrans[0] )
598 {
599 missing_count++;
600 goto next;
601 }
602
603 // verify that the translated engish is the same as the current english
604 GetString ( row, CELL_ENGLISH, olebuf );
605 DecodeFormat ( olebuf );
606
607 if ( wcscmp ( text->Get(), olebuf ) )
608 {
609 // they are two possible reasons for the text to mismatch
610 // 1. text was modified but not re-translated
611 // 2. the IDs are wrong
612 //
613 // to check for the first case we search for the label in the xl file
614 // and make sure it is the same. If not then we have problems
615
616 int nrow = row;
617
618 olebuf2[0] = 0;
619 while ( nrow > 0 )
620 {
621 GetString ( nrow, CELL_LABEL, olebuf2 );
622 if ( olebuf2[0] )
623 {
624 break;
625 }
626 nrow--;
627 }
628
629
630 if ( !olebuf2[0] || wcscmp ( text->Label ()->Name(), olebuf2))
631 {
632 sprintf ( buffer, "%S", olebuf );
633 CVerifyTextDlg dlg(buffer, text->GetSB());
634
635 // didnt find label or label doesn't match
636 // It is possible that the xl was resorted so ask user to do a visual confirmation
637
638 bad_id = dlg.DoModal ()==IDNO;
639 }
640 else if ( text->Label()->FindText( olebuf ))
641 {
642 // we did find the label but text other than the current ID sourced text matches with the import text
643 // this means the ID is definitely wrong
644 bad_id = TRUE;
645 }
646 else
647 {
648 bad_id = FALSE;
649 }
650
651 if ( bad_id )
652 {
653 goto done;
654 }
655
656 }
657
658 // ok import the translation
659
660 Translation *trans;
661
662 if ( ! (trans = text->GetTranslation ( langid )))
663 {
664 new_count++;
665
666 trans = new Translation ();
667 trans->SetLangID ( langid );
668 text->AddTranslation ( trans );
669 }
670
671
672 if ( trans->Revision () == revision && !wcscmp ( trans->Get (), oletrans ))
673 {
674 // already up to date
675 goto next;
676 }
677
678 trans->Set ( oletrans );
679 trans->WaveInfo.SetValid ( FALSE );
680 trans->SetRevision ( revision );
681 changes_count++;
682
683
684 next:
685 count++;
686
687 if ( cb )
688 {
689 cb ();
690 }
691
692 skip:
693 row++;
694 }
695
696done:
697
698 if ( dlg )
699 {
700 sprintf ( buffer, "Total found : %d", count );
701 dlg->Log ( buffer );
702
703 {
704 sprintf ( buffer, "New : %d", new_count);
705 dlg->Log ( buffer );
706 }
707 {
708 sprintf ( buffer, "Updates : %d", (changes_count - new_count));
709 dlg->Log ( buffer );
710 }
711 if ( missing_count )
712 {
713 sprintf ( buffer, "Missing : %d", missing_count );
714 dlg->Log ( buffer );
715 }
716 if ( stale_count )
717 {
718 sprintf ( buffer, "Unmatched : %d", stale_count);
719 dlg->Log ( buffer );
720 }
721
722 }
723
724 if ( bad_id )
725 {
726 if ( dlg )
727 {
728 sprintf ( buffer, "Aborting import: BAD IDs");
729 dlg->Log ( buffer );
730 }
731
732 AfxMessageBox ("The imported translation file has bad string IDs! Fix the string IDs and re-import" );
733 }
734 return count;
735}
736
737static int update_sent_trans ( TransDB *db, LangID langid, void (*cb) ( void ), CBabylonDlg *dlg )
738{
739 int row = 3;
740 int id;
741 int count = 0;
742 int new_count = 0;
743 int matched = 0;
744 int unmatched = 0;
745 int changed = 0;
746 int first_mismatch = TRUE;
747 int bad_id = FALSE;
748 int error_count = 0;
749 int revision;
750
751 while ( (id = GetInt ( row, CELL_STRINGID )) != -1)
752 {
753 if ( id == 0 )
754 {
755 goto skip;
756 }
757
758 BabylonText *text;
759
760 if ( (text = db->FindText ( id )) == NULL )
761 {
762 // string is no longer in database
763 unmatched++;
764 goto next;
765 }
766
767 revision = GetInt ( row, CELL_REVISION );
768
769 if ( text->Revision() > revision )
770 {
771 // old translation
772 changed++;
773 goto next;
774 }
775
776 if ( text->Revision() < revision )
777 {
778 if ( dlg )
779 {
780 sprintf ( buffer, "ERROR: expecting revision %d for string ID %d but found revision %d. Possible bad ID!", text->Revision (), id, revision );
781 dlg->Log ( buffer );
782 }
783 error_count++;
784 goto next;
785 }
786
787
788 // verify that the translated engish is the same as the current english
789 GetString ( row, CELL_ENGLISH, olebuf );
790 DecodeFormat ( olebuf );
791
792 if ( wcscmp ( text->Get(), olebuf ) )
793 {
794 // they are two possible reasons for the text to mismatch
795 // 1. text was modified but not re-translated
796 // 2. the IDs are wrong
797 //
798 // to check for the first case we search for the label in the xl file
799 // and make sure it is the same. If not then we have problems
800
801 int nrow = row;
802
803 olebuf2[0] = 0;
804 while ( nrow > 0 )
805 {
806 GetString ( nrow, CELL_LABEL, olebuf2 );
807 if ( olebuf2[0] )
808 {
809 break;
810 }
811 nrow--;
812 }
813
814
815 if ( !olebuf2[0] || wcscmp ( text->Label ()->Name(), olebuf2))
816 {
817 sprintf ( buffer, "%S", olebuf );
818 CVerifyTextDlg dlg(buffer, text->GetSB());
819
820 // didnt find label or label doesn't match
821 // It is possible that the xl was resorted so ask user to do a visual confirmation
822
823 bad_id = dlg.DoModal ()==IDNO;
824 }
825 else if ( text->Label()->FindText( olebuf ))
826 {
827 // we did find the label but text other than the current ID sourced text matches with the import text
828 // this means the ID is definitely wrong
829 bad_id = TRUE;
830 }
831 else
832 {
833 bad_id = FALSE;
834 }
835
836 if ( bad_id )
837 {
838 goto done;
839 }
840
841 }
842 else
843 {
844 // text is still the same
845 text->Sent ( TRUE );
846 matched++;
847
848 }
849
850 next:
851 count++;
852
853 if ( cb )
854 {
855 cb ();
856 }
857
858 skip:
859 row++;
860 }
861
862done:
863
864 if ( dlg )
865 {
866 sprintf ( buffer, "Total found : %d", count );
867 dlg->Log ( buffer );
868
869 {
870 sprintf ( buffer, "Matched : %d", matched);
871 dlg->Log ( buffer );
872 }
873 {
874 sprintf ( buffer, "Unmatched : %d", unmatched);
875 dlg->Log ( buffer );
876 }
877
878 if ( changed )
879 {
880 sprintf ( buffer, "changed : %d", changed);
881 dlg->Log ( buffer );
882 }
883
884 }
885
886 if ( bad_id )
887 {
888 if ( dlg )
889 {
890 sprintf ( buffer, "Aborting import: BAD IDs");
891 dlg->Log ( buffer );
892 }
893
894 AfxMessageBox ("The imported translation file has bad string IDs! Fix the string IDs and re-import" );
895 }
896 return count;
897}
898
899int ImportTranslations ( TransDB *db, const char *filename, CBabylonDlg *dlg )
900{
901 int imports = -1;
902
903 progress_dlg = dlg;
904 if ( dlg )
905 {
906 dlg->Log ("");
907 sprintf ( buffer, "Importing \"%s\"...", filename );
908 dlg->Status ( buffer );
909 }
910
911 if ( OpenWorkBook ( filename ) )
912 {
913 int num_strings;
914 LANGINFO *info;
915
916 num_strings = GetInt ( ROW_COUNT, COLUMN_COUNT );
918 sprintf ( buffer, "%S", olebuf );
919 info = GetLangInfo ( buffer );
920
921 if ( !info )
922 {
923 if ( dlg )
924 {
925 AfxMessageBox ( "Import file is of an unknown language or is not a translation file" );
926 dlg->Log ( "FAILED", SAME_LINE );
927 dlg->Ready();
928 }
929 CloseWorkBook ();
930 return -1;
931 }
932
933
934 if ( dlg )
935 {
936 dlg->InitProgress ( num_strings );
937 progress_count = 0;
938 sprintf ( buffer, "...%s", info->name );
939 dlg->Log ( buffer, SAME_LINE );
940 }
941
942 imports = import_trans ( db, info->langid, progress_cb, dlg );
943
944 CloseWorkBook ( );
945 }
946 else
947 {
948 if ( dlg )
949 {
950 dlg->Log ("FAILED", SAME_LINE );
951 sprintf ( buffer2, "Failed to open \"%s\"", buffer );
952 AfxMessageBox ( buffer2 );
953 dlg->Log ( buffer2 );
954 }
955 }
956
957 if ( dlg )
958 {
959 dlg->Ready();
960 }
961
962 return imports;
963}
964
965static int generate_Babylonstr ( TransDB *db, const char *filename, LangID langid, GNOPTIONS *options )
966{
967 int ok = FALSE;
968 FILE *file;
969
970 if ( ! ( file = fopen ( filename, "wt" ) ))
971 {
972 goto error;
973 }
974
975 fprintf ( file, "// Generated by %s\n", AppTitle );
976 fprintf ( file, "// Generated on %s %s\n\n\n", __DATE__, __TIME__ );
977
978 {
980 BabylonText *text;
981 Translation *trans;
982 ListSearch sh_label, sh_text;
983
984 label = db->FirstLabel ( sh_label );
985
986 while ( label )
987 {
988 text = label->FirstText ( sh_text );
989
990 fprintf ( file, "\n\n%s\n", label->NameSB ());
991
992 while ( text )
993 {
994 char *string;
995
996 trans = text->GetTranslation ( langid );
997
998 if ( !trans )
999 {
1000 if ( langid == LANGID_US )
1001 {
1002 string = text->GetSB ();
1003 }
1004 else
1005 {
1006 if ( text->Len ())
1007 {
1008 if ( options->untranslated == GN_USEIDS )
1009 {
1010 string = buffer2;
1011 sprintf ( string, "%d", text->ID ());
1012 }
1013 else
1014 {
1015 string = text->GetSB();
1016 }
1017 }
1018 else
1019 {
1020 string = "";
1021 }
1022 }
1023 }
1024 else
1025 {
1026 string = trans->GetSB ();
1027 }
1028
1029 if ( text->Len() == 0 )
1030 {
1031 string = "";
1032 }
1033
1034 fprintf ( file, "\"%s\" %s\n", string, text->WaveSB() );
1035 text = label->NextText ( sh_text );
1036 }
1037
1038 fprintf ( file, "END\n" );
1039 label = db->NextLabel ( sh_label );
1040 }
1041
1042 ok = TRUE;
1043 }
1044error:
1045
1046 if ( file )
1047 {
1048 fclose ( file );
1049 }
1050
1051 return ok;
1052}
1053
1054static int writeCSFLabel ( FILE *file, BabylonLabel *label )
1055{
1056 int id = CSF_LABEL;
1057 int len = strlen ( label->NameSB() );
1058 int strings = label->NumStrings ();
1059
1060 if ( fwrite ( &id, sizeof ( int ), 1, file ) != 1 )
1061 {
1062 return FALSE;
1063 }
1064
1065 if ( fwrite ( &strings, sizeof ( int ), 1, file ) != 1 )
1066 {
1067 return FALSE;
1068 }
1069
1070 if ( fwrite ( &len, sizeof ( int ), 1, file ) != 1 )
1071 {
1072 return FALSE;
1073 }
1074
1075 if ( !len )
1076 {
1077 return FALSE;
1078 }
1079
1080 if ( fwrite ( label->NameSB(), len, 1, file ) != 1 )
1081 {
1082 return FALSE;
1083 }
1084
1085 return TRUE;
1086}
1087
1088static int writeCSFString ( FILE *file, OLECHAR *string, char *wave, LANGINFO *linfo )
1089{
1090 int id = CSF_STRING;
1091 int len ;
1092 int wlen = strlen ( wave );
1093
1094 if ( wlen )
1095 {
1096 id = CSF_STRINGWITHWAVE;
1097 }
1098
1099 wcscpy ( olebuf, string );
1100 StripSpaces ( olebuf );
1101 ConvertMetaChars ( olebuf );
1102 len = wcslen ( olebuf );
1103
1104 {
1105 OLECHAR *ptr = olebuf;
1106
1107 while ( *ptr)
1108 {
1109 *ptr = ~*ptr++;
1110 }
1111
1112 }
1113
1114 if ( fwrite ( &id, sizeof ( int ), 1, file ) != 1 )
1115 {
1116 return FALSE;
1117 }
1118
1119 if ( fwrite ( &len, sizeof ( int ), 1, file ) != 1 )
1120 {
1121 return FALSE;
1122 }
1123
1124 if ( len )
1125 {
1126 if ( fwrite ( olebuf, len*sizeof(OLECHAR), 1, file ) != 1 )
1127 {
1128 return FALSE;
1129 }
1130 }
1131 if ( wlen )
1132 {
1133 wlen++;
1134 if ( fwrite ( &wlen, sizeof ( int ), 1, file ) != 1 )
1135 {
1136 return FALSE;
1137 }
1138
1139 if ( fwrite ( wave, wlen-1, 1, file ) != 1 )
1140 {
1141 return FALSE;
1142 }
1143 if ( fwrite ( linfo->character, 1, 1, file ) != 1 )
1144 {
1145 return FALSE;
1146 }
1147 }
1148 return TRUE;
1149}
1150
1151static int generate_csf ( TransDB *db, const char *filename, LangID langid, GNOPTIONS *options )
1152{
1153 CSF_HEADER header;
1154 int header_size;
1155 int ok = FALSE;
1156 FILE *file;
1157 LANGINFO *linfo = GetLangInfo ( langid);
1158
1159 if ( ! ( file = fopen ( filename, "w+b" ) ))
1160 {
1161 goto error;
1162 }
1163
1164 header.id = CSF_ID;
1165 header.version = CSF_VERSION;
1166 header.skip = 0;
1167 header.num_labels = 0;
1168 header.num_strings = 0;
1169 header.langid = langid;
1170 header_size = sizeof ( header );
1171
1172 fseek ( file, header_size, SEEK_SET );
1173
1174 {
1176 BabylonText *text;
1177 Translation *trans;
1178 ListSearch sh_label, sh_text;
1179
1180 label = db->FirstLabel ( sh_label );
1181
1182 while ( label )
1183 {
1184 text = label->FirstText ( sh_text );
1185
1186 if ( !writeCSFLabel ( file, label ) )
1187 {
1188 goto error;
1189 }
1190 header.num_labels++;
1191
1192 while ( text )
1193 {
1194 OLECHAR *string;
1195
1196 trans = text->GetTranslation ( langid );
1197
1198 if ( !trans )
1199 {
1200 if ( langid == LANGID_US )
1201 {
1202 string = text->Get ();
1203 }
1204 else
1205 {
1206 if ( text->Len ())
1207 {
1208 if ( options->untranslated == GN_USEIDS )
1209 {
1210 string = olebuf2;
1211 swprintf ( string, L"%d", text->ID ());
1212 }
1213 else
1214 {
1215 string = text->Get();
1216 }
1217 }
1218 else
1219 {
1220 string = L"";
1221 }
1222 }
1223 }
1224 else
1225 {
1226 string = trans->Get ();
1227 }
1228
1229 if ( !writeCSFString ( file, string, text->WaveSB (), linfo ) )
1230 {
1231 goto error;
1232 }
1233 header.num_strings ++;
1234
1235 text = label->NextText ( sh_text );
1236 }
1237
1238 label = db->NextLabel ( sh_label );
1239 }
1240
1241 fseek ( file, 0, SEEK_SET );
1242 if ( fwrite ( &header, header_size, 1, file ) != 1 )
1243 {
1244 goto error;
1245 }
1246
1247 fseek ( file, 0, SEEK_END );
1248
1249 ok = TRUE;
1250 }
1251
1252error:
1253
1254 if ( file )
1255 {
1256 fclose ( file );
1257 }
1258
1259
1260 return ok;
1261}
1262
1263
1264int GenerateGameFiles ( TransDB *db, const char *filepattern, GNOPTIONS *options, LangID *languages, CBabylonDlg *dlg)
1265{
1266 static char filename[2*1024];
1267 LangID langid;
1268 int count= 0 ;
1269 int num;
1270
1271 if ( dlg )
1272 {
1273 LangID *temp = languages;
1274 num = 0;
1275 while ( *temp++ != LANGID_UNKNOWN )
1276 {
1277 num++;
1278 }
1279
1280 dlg->Log ( "" );
1281 dlg->Status ( "Generating game files:" );
1282 dlg->InitProgress ( num );
1283 num = 0;
1284 }
1285 while ( (langid = *languages++) != LANGID_UNKNOWN )
1286 {
1287 LANGINFO *info;
1288 TRNREPORT trnreport;
1289 DLGREPORT dlgreport;
1290 int dlgwarning;
1291 int trnwarning;
1292 int done;
1293
1294 info = GetLangInfo ( langid );
1295
1296 sprintf ( filename, "%s_%s.%s", filepattern, info->initials, options->format == GN_BABYLONSTR ? "str" : "csf" );
1297 strlwr ( filename );
1298
1299 if ( dlg )
1300 {
1301 sprintf ( buffer, "Writing: %s - %s...", filename, GetLangName ( langid ));
1302 dlg->Status ( buffer );
1303 dlgwarning = db->ReportDialog ( &dlgreport, langid );
1304 trnwarning = db->ReportTranslations ( &trnreport, langid );
1305 }
1306
1307
1308 if ( options->format == GN_BABYLONSTR )
1309 {
1310 done = generate_Babylonstr ( db, filename, langid, options );
1311 }
1312 else
1313 {
1314 done = generate_csf ( db, filename, langid, options );
1315 }
1316
1317 if ( done )
1318 {
1319 count++;
1320 if ( dlg )
1321 {
1322 if ( trnwarning || dlgwarning )
1323 {
1324 dlg->Log ( "WARNING", SAME_LINE );
1325
1326 if ( trnwarning )
1327 {
1328 int missing;
1329
1330 if ( (missing = trnreport.missing + trnreport.retranslate) )
1331 {
1332 sprintf ( buffer, "%d translation%s missing", missing, missing > 1 ? "s are" : " is" );
1333 dlg->Log ( buffer );
1334 }
1335
1336 if ( trnreport.too_big )
1337 {
1338 sprintf ( buffer, "%d string%s too big", trnreport.too_big, trnreport.too_big > 1 ? "s are" : " is" );
1339 dlg->Log ( buffer );
1340 }
1341
1342 if ( trnreport.bad_format )
1343 {
1344 sprintf ( buffer, "%d translation%s bad format", trnreport.bad_format, trnreport.bad_format > 1 ? "s have a" : " has a" );
1345 dlg->Log ( buffer );
1346 }
1347 }
1348
1349 if ( dlgwarning )
1350 {
1351 if ( dlgreport.missing )
1352 {
1353 sprintf ( buffer, "%d dialog%s missing", dlgreport.missing, dlgreport.missing > 1 ? "s are" : " is" );
1354 dlg->Log ( buffer );
1355 }
1356
1357 if ( dlgreport.unresolved )
1358 {
1359 sprintf ( buffer, "%d dialog%s not verified", dlgreport.unresolved, dlgreport.unresolved> 1 ? "s are" : " is" );
1360 dlg->Log ( buffer );
1361 }
1362 }
1363 }
1364 else
1365 {
1366 dlg->Log ( "OK", SAME_LINE );
1367 }
1368 }
1369 }
1370 else
1371 {
1372 if ( dlg )
1373 {
1374 dlg->Log ( "FAILED", SAME_LINE );
1375 }
1376 }
1377
1378 if ( dlg )
1379 {
1380 dlg->SetProgress ( ++num );
1381 }
1382
1383 }
1384
1385 if ( dlg )
1386 {
1387 dlg->Ready ();
1388 }
1389 return count;
1390}
1391
1392void ProcessWaves ( TransDB *db, const char *filename, CBabylonDlg *dlg )
1393{
1394 int imports = -1;
1395
1396 progress_dlg = dlg;
1397
1398 if ( dlg )
1399 {
1400 dlg->Log ("");
1401 sprintf ( buffer, "Processing wavefile \"%s\"...", filename );
1402 dlg->Status ( buffer );
1403 }
1404
1405 if ( OpenWorkBook ( filename ) )
1406 {
1407 int row = 1;
1408 int last_row = 1;
1409 int matches = 0;
1410 int unmatched = 0;
1411 FILE *file = NULL;
1412 char *ptr;
1413
1414 strcpy ( buffer, filename );
1415
1416 if ( (ptr = strchr ( buffer, '.' )) )
1417 {
1418 *ptr = 0;
1419 }
1420
1421 strcat ( buffer, ".txt" );
1422
1423 if ( (file = fopen (buffer, "wt" )))
1424 {
1425
1426 while ( row - last_row < 1000 )
1427 {
1428 BabylonText *text;
1429
1430 GetString ( row, 'J' - 'A' + 1, olebuf );
1431
1432 wcslwr ( olebuf );
1433
1434 if ( wcsstr ( olebuf, L".wav" ) )
1435 {
1436 last_row = row;
1437
1438 fprintf ( file, "%S : ", olebuf );
1439 GetString ( row, 'K' -'A' + 1, olebuf );
1440 StripSpaces ( olebuf );
1441
1442 if ( (text = db->FindSubText ( olebuf ) ))
1443 {
1444 fprintf ( file, "%6d", text->LineNumber () );
1445 }
1446 else
1447 {
1448 fprintf ( file, "??????" );
1449 }
1450
1451 fprintf ( file, " - \"%S\"\n", olebuf );
1452 }
1453
1454 row++;
1455 }
1456
1457 fclose ( file );
1458 }
1459
1460 CloseWorkBook ( );
1461 }
1462 else
1463 {
1464 if ( dlg )
1465 {
1466 dlg->Log ("FAILED", SAME_LINE );
1467 sprintf ( buffer2, "Failed to open \"%s\"", buffer );
1468 AfxMessageBox ( buffer2 );
1469 dlg->Log ( buffer2 );
1470 }
1471 }
1472
1473 if ( dlg )
1474 {
1475 dlg->Ready();
1476 }
1477
1478}
1479
1480
1481int GenerateReport ( TransDB *db, const char *filename, RPOPTIONS *options, LangID *languages, CBabylonDlg *dlg)
1482{
1483 LangID langid;
1484 int count= 0 ;
1485 int num;
1486 FILE *file = NULL;
1487
1488 if ( dlg )
1489 {
1490 LangID *temp = languages;
1491 num = 0;
1492 while ( *temp++ != LANGID_UNKNOWN )
1493 {
1494 num++;
1495 }
1496
1497 dlg->Log ( "" );
1498 dlg->Status ( "Generating Report:" );
1499 dlg->InitProgress ( num );
1500 num = 0;
1501 }
1502
1503 if ( ! ( file = fopen ( filename, "wt" )))
1504 {
1505 static char buffer[500];
1506
1507 sprintf ( "Unable to open file \"%s\".\n\nCannot create report!", filename);
1508 AfxMessageBox ( buffer );
1509
1510 if ( dlg )
1511 {
1512 dlg->Log ( "FAILED", SAME_LINE );
1513 dlg->Ready ();
1514 }
1515 return 0;
1516 }
1517
1518 cb_file = file;
1519
1520 {
1521 char date[50];
1522 char time[50];
1523 _strtime ( time );
1524 _strdate ( date );
1525 fprintf ( file, "Babylon Report: %s %s\n", date, time);
1526 }
1527
1528
1529
1530 while ( (langid = *languages++) != LANGID_UNKNOWN )
1531 {
1532 LANGINFO *info;
1533 TRNREPORT tr_report;
1534 DLGREPORT dlg_report;
1535
1536 info = GetLangInfo ( langid );
1537
1538 fprintf ( file, "\n\n%s Status:\n", info->name );
1539
1540
1541 if ( options->translations )
1542 {
1543 int count;
1544
1545 count = db->ReportTranslations ( &tr_report, langid );
1546
1547 fprintf ( file, "\n\tText Summary: %s\n", info->name );
1548 fprintf ( file, "\t-------------\n\n");
1549
1550 fprintf ( file, "\t\tErrors: %d\n", tr_report.errors);
1551
1552 if ( langid != LANGID_US )
1553 {
1554 fprintf ( file, "\t\tNot translated: %d\n", tr_report.missing);
1555 fprintf ( file, "\t\tRetranslation: %d\n", tr_report.retranslate);
1556 fprintf ( file, "\t\tTranslated: %d\n", tr_report.translated );
1557 }
1558 fprintf ( file, "\t\tTotal text: %d\n", tr_report.numstrings );
1559
1560 if ( count && count < options->limit )
1561 {
1562 fprintf ( file, "\n\tText Details: %s\n", info->name);
1563 fprintf ( file, "\t------------\n\n" );
1564 db->ReportTranslations ( &tr_report, langid, print_to_file );
1565 }
1566
1567 }
1568
1569 if ( options->dialog )
1570 {
1571 int count;
1572
1573 count = db->ReportDialog ( &dlg_report, langid );
1574
1575 fprintf ( file, "\n\tDialog Summary: %s\n", info->name );
1576 fprintf ( file, "\t-------------\n\n");
1577
1578 fprintf ( file, "\t\tMissing Audio: %d\n", dlg_report.missing);
1579 fprintf ( file, "\t\tNot verified: %d\n", dlg_report.unresolved);
1580 fprintf ( file, "\t\tVerified: %d\n", dlg_report.resolved);
1581 fprintf ( file, "\t\tTotal dialog: %d\n", dlg_report.numdialog );
1582
1583 if ( count && count < options->limit )
1584 {
1585 fprintf ( file, "\n\tDialog Details: %s\n", info->name );
1586 fprintf ( file, "\t------------\n\n" );
1587 db->ReportDialog ( &dlg_report, langid, print_to_file );
1588 }
1589 }
1590
1591 if ( dlg )
1592 {
1593 dlg->SetProgress ( ++num );
1594 }
1595
1596 }
1597
1598 if ( dlg )
1599 {
1600 dlg->Ready ();
1601 }
1602
1603 fclose ( file );
1604
1605 return count;
1606}
1607
1608int UpdateSentTranslations ( TransDB *db, const char *filename, CBabylonDlg *dlg )
1609{
1610 int imports = -1;
1611
1612 progress_dlg = dlg;
1613 if ( dlg )
1614 {
1615 dlg->Log ("");
1616 sprintf ( buffer, "Importing \"%s\"...", filename );
1617 dlg->Status ( buffer );
1618 }
1619
1620 if ( OpenWorkBook ( filename ) )
1621 {
1622 int num_strings;
1623 LANGINFO *info;
1624
1625 num_strings = GetInt ( ROW_COUNT, COLUMN_COUNT );
1627 sprintf ( buffer, "%S", olebuf );
1628 info = GetLangInfo ( buffer );
1629
1630 if ( !info )
1631 {
1632 if ( dlg )
1633 {
1634 AfxMessageBox ( "Import file is of an unknown language or is not a translation file" );
1635 dlg->Log ( "FAILED", SAME_LINE );
1636 dlg->Ready();
1637 }
1638 CloseWorkBook ();
1639 return -1;
1640 }
1641
1642
1643 if ( dlg )
1644 {
1645 dlg->InitProgress ( num_strings );
1646 progress_count = 0;
1647 sprintf ( buffer, "...%s", info->name );
1648 dlg->Log ( buffer, SAME_LINE );
1649 }
1650
1651 imports = update_sent_trans ( db, info->langid, progress_cb, dlg );
1652
1653 CloseWorkBook ( );
1654 }
1655 else
1656 {
1657 if ( dlg )
1658 {
1659 dlg->Log ("FAILED", SAME_LINE );
1660 sprintf ( buffer2, "Failed to open \"%s\"", buffer );
1661 AfxMessageBox ( buffer2 );
1662 dlg->Log ( buffer2 );
1663 }
1664 }
1665
1666 if ( dlg )
1667 {
1668 dlg->Ready();
1669 }
1670
1671 return imports;
1672}
1673
char AppTitle[200]
Definition Babylon.cpp:37
char DialogPath[_MAX_PATH]
Definition Babylon.cpp:69
@ SAME_LINE
Definition BabylonDlg.h:34
#define NULL
Definition BaseType.h:92
#define TRUE
Definition BaseType.h:109
#define FALSE
Definition BaseType.h:113
#define CSF_STRINGWITHWAVE
Definition GameText.cpp:83
#define CSF_STRING
Definition GameText.cpp:82
#define CSF_LABEL
Definition GameText.cpp:81
#define CSF_VERSION
Definition GameText.cpp:84
#define CSF_ID
Definition GameText.cpp:80
#define SEEK_SET
Definition WWFILE.H:55
#define SEEK_END
Definition WWFILE.H:57
char * GetLangName(LangID langid)
Definition TransDB.cpp:79
LANGINFO * GetLangInfo(int index)
Definition TransDB.cpp:50
LangID
Definition TransDB.h:69
@ LANGID_US
Definition TransDB.h:70
@ LANGID_JABBER
Definition TransDB.h:77
@ LANGID_UNKNOWN
Definition TransDB.h:80
int PutCell(int row, int column, OLECHAR *string, int val)
Definition XLStuff.cpp:86
int GetInt(int row, int cell)
Definition XLStuff.cpp:640
int GetString(int row, int cell, OLECHAR *string)
Definition XLStuff.cpp:656
int SaveWorkBook(const char *filename, int protect)
Definition XLStuff.cpp:582
int OpenWorkBook(const char *filename)
Definition XLStuff.cpp:509
int NewWorkBook(const char *path)
Definition XLStuff.cpp:530
void CloseWorkBook(void)
Definition XLStuff.cpp:615
@ CELL_STRINGID
Definition XLStuff.h:228
@ CELL_ENGLISH
Definition XLStuff.h:229
@ CELL_COMMENT
Definition XLStuff.h:232
@ CELL_LISTENER
Definition XLStuff.h:227
@ CELL_CONTEXT
Definition XLStuff.h:231
@ CELL_LOCALIZED
Definition XLStuff.h:230
@ CELL_REVISION
Definition XLStuff.h:236
@ CELL_LENCHECK
Definition XLStuff.h:235
@ CELL_MAXLEN
Definition XLStuff.h:233
@ CELL_LABEL
Definition XLStuff.h:225
@ CELL_WAVEFILE
Definition XLStuff.h:224
@ CELL_STRLEN
Definition XLStuff.h:234
@ CELL_SPEAKER
Definition XLStuff.h:226
#define COLUMN_COUNT
Definition XLStuff.h:241
#define COLUMN_LANGUAGE
Definition XLStuff.h:243
#define ROW_LANGUAGE
Definition XLStuff.h:242
#define ROW_COUNT
Definition XLStuff.h:240
BabylonText * FindText(OLECHAR *find_text)
Definition TransDB.cpp:686
OLECHAR * Name(void)
Definition TransDB.h:318
int IsSent(void)
Definition TransDB.cpp:807
int Revision(void)
Definition TransDB.h:246
int DialogIsValid(const char *path, LangID langid=LANGID_US, int check=TRUE)
Definition TransDB.cpp:943
void Sent(int val)
Definition TransDB.cpp:812
BabylonLabel * Label(void)
Definition TransDB.h:245
char * GetSB(void)
Definition TransDB.h:237
int ID(void)
Definition TransDB.h:232
int Len(void)
Definition TransDB.h:236
char * WaveSB(void)
Definition TransDB.h:244
Translation * GetTranslation(LangID langid)
Definition TransDB.cpp:1105
int IsDialog(void)
Definition TransDB.cpp:936
int DialogIsPresent(const char *path, LangID langid=LANGID_US)
Definition TransDB.cpp:1046
OLECHAR * Wave(void)
Definition TransDB.h:243
OLECHAR * Get(void)
Definition TransDB.h:235
int LineNumber(void)
Definition TransDB.h:250
void AddTranslation(Translation *trans)
Definition TransDB.cpp:1068
void SetProgress(int pos)
void Status(const char *string, int log=TRUE)
void InitProgress(int range)
void Ready(void)
Definition BabylonDlg.h:101
void Log(const char *string, LogFormat format=NEW_LINE)
void SetValid(int new_valid)
Definition TransDB.h:110
BabylonLabel * FirstLabel(ListSearch &sh)
Definition TransDB.cpp:257
BabylonText * FindSubText(OLECHAR *text, int item=0)
Definition TransDB.cpp:316
int ReportDialog(DLGREPORT *report, LangID langid, void(*print)(const char *)=NULL, PMASK pmask=PMASK_ALL)
Definition TransDB.cpp:1713
int ReportTranslations(TRNREPORT *report, LangID langid, void(*print)(const char *)=NULL, PMASK pmask=PMASK_ALL)
Definition TransDB.cpp:1784
BabylonLabel * NextLabel(ListSearch &sh)
Definition TransDB.cpp:269
BabylonText * FindText(OLECHAR *text)
Definition TransDB.cpp:310
int Revision(void)
Definition TransDB.h:183
void SetRevision(int new_rev)
Definition TransDB.h:184
int ValidateFormat(BabylonText *text)
Definition TransDB.cpp:1434
CWaveInfo WaveInfo
Definition TransDB.h:161
void Set(OLECHAR *string)
Definition TransDB.h:174
OLECHAR * Get(void)
Definition TransDB.h:176
char * GetSB(void)
Definition TransDB.h:178
int TooLong(int maxlen)
Definition TransDB.cpp:1428
void SetLangID(LangID new_id)
Definition TransDB.h:168
int GenerateGameFiles(TransDB *db, const char *filepattern, GNOPTIONS *options, LangID *languages, CBabylonDlg *dlg)
Definition expimp.cpp:1264
int UpdateSentTranslations(TransDB *db, const char *filename, CBabylonDlg *dlg)
Definition expimp.cpp:1608
int ImportTranslations(TransDB *db, const char *filename, CBabylonDlg *dlg)
Definition expimp.cpp:899
int ExportTranslations(TransDB *db, const char *filename, LangID langid, TROPTIONS *options, CBabylonDlg *dlg)
Definition expimp.cpp:405
void ProcessWaves(TransDB *db, const char *filename, CBabylonDlg *dlg)
Definition expimp.cpp:1392
int GenerateReport(TransDB *db, const char *filename, RPOPTIONS *options, LangID *languages, CBabylonDlg *dlg)
Definition expimp.cpp:1481
@ TR_UNSENT
Definition expimp.h:38
@ TR_NONDIALOG
Definition expimp.h:34
@ TR_SAMPLE
Definition expimp.h:35
@ TR_DIALOG
Definition expimp.h:33
@ TR_UNVERIFIED
Definition expimp.h:37
@ TR_CHANGES
Definition expimp.h:32
@ TR_ALL
Definition expimp.h:31
@ TR_MISSING_DIALOG
Definition expimp.h:36
@ GN_BABYLONSTR
Definition expimp.h:52
@ GN_USEIDS
Definition expimp.h:57
int FileExists(const char *filename)
Definition fileops.cpp:29
void EncodeFormat(text *string)
void ConvertMetaChars(text *string)
void DecodeFormat(text *string)
void StripSpaces(text *string)
int IsFormatTypeChar(text ch)
Definition olestring.cpp:47
int id
Definition expimp.h:95
int version
Definition expimp.h:96
int num_labels
Definition expimp.h:97
int skip
Definition expimp.h:99
int num_strings
Definition expimp.h:98
int langid
Definition expimp.h:100
int unresolved
Definition TransDB.h:37
int numdialog
Definition TransDB.h:35
int missing
Definition TransDB.h:36
int resolved
Definition TransDB.h:38
GnFormat format
Definition expimp.h:63
GnUntranslated untranslated
Definition expimp.h:64
char * name
Definition TransDB.h:86
LangID langid
Definition TransDB.h:85
char * character
Definition TransDB.h:88
char * initials
Definition TransDB.h:87
int dialog
Definition expimp.h:71
int translations
Definition expimp.h:70
int errors
Definition TransDB.h:50
int retranslate
Definition TransDB.h:48
int missing
Definition TransDB.h:47
int bad_format
Definition TransDB.h:51
int too_big
Definition TransDB.h:49
int translated
Definition TransDB.h:52
int numstrings
Definition TransDB.h:46
int include_translations
Definition expimp.h:45
TrFilter filter
Definition expimp.h:43
int include_comments
Definition expimp.h:44
#define label
Definition template.h:41