Changeset 28503

Show
Ignore:
Timestamp:
21.10.2013 20:57:25 (6 years ago)
Author:
ak19
Message:

1. The process of submitting translation spreadsheets produced some errors in borderline cases saying that the source string of the spreadsheet didn't match the one in the original translation file owing to newline entity differences and differences as to when entities got expanded during the check for whether the source strings still matched. These cases are now handled. 2. Added debugging statements in key positions (but commented out).

Location:
main/trunk/greenstone2/bin/script
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/bin/script/gti-process-spreadsheet.pl

    r13318 r28503  
    8383    $source_file_chunk =~ /^(\S+)\s+((.|\n)*)$/; 
    8484    my $source_file_chunk_key = $1; 
     85#   print STDERR "******** key: |$source_file_chunk_key| "; 
    8586    my $source_file_chunk_text = $2; 
     87#   print STDERR "******** text: |$source_file_chunk_text|\n"; 
    8688    $target_file_chunk =~ /^(\S+)\s+((.|\n)*)$/; 
    8789    my $target_file_chunk_key = $1; 
     
    9092    # Remove the quotes around multiline chunks 
    9193    if ($source_file_chunk_text =~ /^\"/ && $source_file_chunk_text =~ /\"$/) { 
     94#       print STDERR "******** source text: |$source_file_chunk_text| \n"; 
    9295        $source_file_chunk_text =~ s/^\"//; 
    9396        $source_file_chunk_text =~ s/\"$//; 
    9497    } 
    9598    if ($target_file_chunk_text =~ /^\"/ && $target_file_chunk_text =~ /\"$/) { 
     99#       print STDERR "******** target text: |$target_file_chunk_text| \n"; 
    96100        $target_file_chunk_text =~ s/^\"//; 
    97101        $target_file_chunk_text =~ s/\"$//; 
    98102    } 
     103#   else { 
     104#       print STDERR "******** !target text: |$target_file_chunk_text| \n"; 
     105#   } 
    99106 
    100107        # Remove the blank space Excel adds at the start of each line 
     
    106113    $target_file_chunk_text =~ s/\"\"/\"/g; 
    107114 
     115    # ensure newline html entities in the unicode txt file version of the spreadsheet are replaced with newlines 
     116    $source_file_chunk_text =~ s/
 /\n/g; 
     117    $target_file_chunk_text =~ s/
 /\n/g; 
     118 
    108119    print "<SourceFileText key=\"" . $source_file_chunk_key . "\">\n" . $source_file_chunk_text . "\n</SourceFileText>\n"; 
    109120    print "<TargetFileText key=\"" . $target_file_chunk_key . "\">\n" . $target_file_chunk_text . "\n</TargetFileText>\n"; 
  • main/trunk/greenstone2/bin/script/gti.pl

    r28337 r28503  
    669669         
    670670        # Make sure the submitted source chunk matches the source file chunk 
    671         if ($source_file_key_to_submission_mapping{$chunk_key} ne &unmake_text_xml_safe($source_file_key_to_text_mapping{$chunk_key})) { 
     671        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})) { 
     672                    #print STDERR "**** $source_file_key_to_submission_mapping{$chunk_key}\n"; 
     673                #print STDERR "**** " . &unmake_text_xml_safe($source_file_key_to_text_mapping{$chunk_key}) ."\n"; 
     674 
    672675            &log_message("Warning: Source chunk $chunk_key has changed (ignoring submission)."); 
    673676            &log_message("Submission source: $source_file_key_to_submission_mapping{$chunk_key}");