Changeset 33436 for main/trunk/greenstone2/bin/script/gti.pl
- Timestamp:
- 2019-08-23T23:21:17+12:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/bin/script/gti.pl
r32517 r33436 594 594 ($source_file, $target_file, $translation_file_type) 595 595 = &get_translation_configuration($target_language_code, $translation_file_key); 596 597 #&log_message("********************** START SOURCE ***********************************"); 596 598 597 599 # Parse the source language and target language files … … 600 602 %source_file_key_to_text_mapping = &build_key_to_text_mapping(\@source_file_lines, \%source_file_key_to_line_mapping, $translation_file_type); 601 603 %source_file_key_to_gti_comment_mapping = &build_key_to_gti_comment_mapping(\@source_file_lines, \%source_file_key_to_line_mapping, $translation_file_type); 604 605 #&log_message("********************** START TARGET ***********************************"); 602 606 603 607 @target_file_lines = &read_file_lines(&util::filename_cat($gsdl_root_directory, $target_file)); … … 626 630 # &log_message("Submission:"); 627 631 foreach my $submission_line (@submission_lines) { 628 $submission_line =~ s/\r$//; 632 $submission_line =~ s/\r$//; 633 $submission_line =~ s/ +$//; 629 634 #&log_message(" $submission_line"); 630 635 } … … 647 652 $source_file_chunk_text = &unmake_text_xml_safe($source_file_chunk_text); 648 653 649 #&log_message("Source file key: $chunk_key");650 #&log_message("Source file text: $source_file_chunk_text");654 #&log_message("Source file key: |$chunk_key|"); 655 #&log_message("Source file text: |$source_file_chunk_text|"); 651 656 $source_file_key_to_submission_mapping{$chunk_key} = $source_file_chunk_text; 652 657 } … … 666 671 $target_file_chunk_text = &unmake_text_xml_safe($target_file_chunk_text); 667 672 668 #&log_message("Target file key: $chunk_key");669 #&log_message("Target file text: $target_file_chunk_text");673 #&log_message("Target file key: |$chunk_key|"); 674 #&log_message("Target file text: |$target_file_chunk_text|"); 670 675 $target_file_key_to_submission_mapping{$chunk_key} = $target_file_chunk_text; 671 676 } … … 691 696 692 697 # Make sure the submitted source chunk matches the source file chunk 693 if ($source_file_key_to_submission_mapping{$chunk_key} ne &unmake_text_xml_safe($source_file_key_to_text_mapping{$chunk_key})) { 698 if ($source_file_key_to_submission_mapping{$chunk_key} ne $source_file_key_to_text_mapping{$chunk_key} 699 && $source_file_key_to_submission_mapping{$chunk_key} ne &unmake_text_xml_safe($source_file_key_to_text_mapping{$chunk_key})) { 694 700 #if (&unmake_text_xml_safe($source_file_key_to_submission_mapping{$chunk_key}) ne &unmake_text_xml_safe($source_file_key_to_text_mapping{$chunk_key})) { 695 # print STDERR "**** $source_file_key_to_submission_mapping{$chunk_key}\n";696 # print STDERR "**** " . &unmake_text_xml_safe($source_file_key_to_text_mapping{$chunk_key}) ."\n";701 #&log_message("**** submission source:\n|$source_file_key_to_submission_mapping{$chunk_key}|\n"); 702 #&log_message("**** unmake xml safe source:\n|" . &unmake_text_xml_safe($source_file_key_to_text_mapping{$chunk_key}) ."|\n"); 697 703 698 704 &log_message("Warning: Source chunk $chunk_key has changed (ignoring submission)."); … … 939 945 eval "\$key_to_text_mapping{\${chunk_key}} = &import_chunk_from_${translation_file_type}(\$chunk_text)"; 940 946 947 #&log_message("@@@ chunk key: $chunk_key"); 948 #&log_message("@@@ source string: |" . $key_to_text_mapping{$chunk_key} . "|"); 949 950 941 951 #if($chunk_key =~ m/document\\/) { 942 952 #&log_message("Submission source: $source_file_key_to_submission_mapping{$chunk_key}"); … … 1620 1630 my $line = $file_lines[$i]; 1621 1631 $line =~ s/(\s*)$//; # Remove any nasty whitespace, carriage returns etc. 1632 #&log_message("Got line: ".$line); 1622 1633 1623 1634 # a property line has a colon/equals sign as separator that is NOT escaped with a backslash (both keys and values … … 1765 1776 my $line = $file_lines[$i]; 1766 1777 $line =~ s/(\s*)$//; # Remove any nasty whitespace, carriage returns etc. 1767 1778 #&log_message("Got line: ".$line); 1768 1779 # Line contains a string to translate 1769 1780 if ($line =~ /^\s*<Text id=\"(.*?)\">/) { … … 1774 1785 # While there is still text of the string to go... 1775 1786 my $startline = $i; 1776 while ($line !~ /<\/Text> $/) {1787 while ($line !~ /<\/Text>\s*$/) { 1777 1788 $i++; 1778 1789 if ($i == scalar(@file_lines)) { … … 1783 1794 $line =~ s/<Updated date=\"\d?\d-\D\D\D-\d\d\d\d.*\"\/>$//; 1784 1795 } 1785 1796 #&log_message("@@@ Line is now: ".$line); 1786 1797 # Map from chunk key to line 1787 1798 if (!defined($chunk_key_to_line_mapping{$chunk_key})) { … … 1805 1816 $chunk_text =~ s/^\s*<Text id=\"(.*?)\">(\s*)//; 1806 1817 $chunk_text =~ s/<Updated date=\"\d?\d-\D\D\D-\d\d\d\d.*\"\/>$//; 1807 $chunk_text =~ s/ <\/Text>$//;1818 $chunk_text =~ s/\s*<\/Text>\s*$//; 1808 1819 1809 1820 return $chunk_text;
Note:
See TracChangeset
for help on using the changeset viewer.