Changeset 30548

Show
Ignore:
Timestamp:
01.06.2016 19:25:46 (3 years ago)
Author:
ak19
Message:

Fixing gti.pl: previously for just the gs3interface module, if any strings that required translating got translated, they'd immediately be added to the list of strings that require updating. This was due to an oversight in build_gs3_configuration() which was not getting the last_updated_mapping when it needed, but always getting the gti_comments instead. Now it gets whichever of these is appropriate, and things work at last.

Files:
1 modified

Legend:

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

    r30490 r30548  
    519519        my (%source_file_key_to_gti_command_mapping, %target_file_key_to_gti_command_mapping) = (); 
    520520        &build_gs3_configuration($target_language_code, \%source_file_key_to_text_mapping, \%target_file_key_to_text_mapping, 
    521         \%source_file_key_to_gti_command_mapping, \%target_file_key_to_gti_command_mapping); 
     521        \%source_file_key_to_gti_command_mapping, \%target_file_key_to_gti_command_mapping, 1); 
    522522    } 
    523523     
     
    598598    else { 
    599599        &build_gs3_configuration($target_language_code, \%source_file_key_to_text_mapping, \%target_file_key_to_text_mapping,  
    600         \%source_file_key_to_gti_comment_mapping, \%target_file_key_to_gti_comment_mapping); 
     600        \%source_file_key_to_gti_comment_mapping, \%target_file_key_to_gti_comment_mapping, 1); 
    601601    } 
    602602    &log_message("Number of source chunks: " . scalar(keys(%source_file_key_to_text_mapping))); 
     
    10641064        my $target_chunk_last_update_date = $target_file_key_to_last_update_date_mapping->{$chunk_key}; 
    10651065         
    1066         # print "key: $chunk_key\nsource date : $source_chunk_last_update_date\ntarget date : $target_chunk_last_update_date\nafter? ". &is_date_after($source_chunk_last_update_date, $target_chunk_last_update_date) . "\n\n";         
    1067          
     1066        # print "key: $chunk_key\nsource date : $source_chunk_last_update_date\ntarget date : $target_chunk_last_update_date\nafter? ". &is_date_after($source_chunk_last_update_date, $target_chunk_last_update_date) . "\n\n"; 
     1067 
    10681068        if (defined($target_chunk_last_update_date) && &is_date_after($source_chunk_last_update_date, $target_chunk_last_update_date)) { 
    10691069            # &log_message("Chunk with key $chunk_key needs updating."); 
     1070                # &log_message("key: $chunk_key\nsource date : $source_chunk_last_update_date\ntarget date : $target_chunk_last_update_date\nafter? ". &is_date_after($source_chunk_last_update_date, $target_chunk_last_update_date) . "\n\n"); 
    10701071            push(@target_file_keys_requiring_updating, $chunk_key); 
    10711072        } 
     
    20222023{ 
    20232024    my ($target_language_code, $source_files_key_to_text_mapping, $target_files_key_to_text_mapping, 
    2024     $source_files_key_to_gti_comment_mapping, $target_files_key_to_gti_comment_mapping) = @_; 
     2025    $source_files_key_to_gti_comment_or_last_updated_mapping, $target_files_key_to_gti_comment_or_last_updated_mapping, $get_gti_comments_not_last_updated) = @_; 
    20252026     
    20262027    my $source_file_directory = "greenstone3";  # my $source_file_directory = &util::filename_cat("WEB-INF","classes");  
     
    20362037        my %source_file_key_to_line_mapping = &build_key_to_line_mapping(\@source_file_lines, $translation_file_type); 
    20372038        my %source_file_key_to_text_mapping = &build_key_to_text_mapping(\@source_file_lines, \%source_file_key_to_line_mapping, $translation_file_type); 
    2038         my %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);  
    2039          
     2039        #my %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);     
     2040         
     2041        my %source_file_key_to_gti_comment_or_last_updated_mapping; 
     2042        if($get_gti_comments_not_last_updated) { 
     2043            %source_file_key_to_gti_comment_or_last_updated_mapping = &build_key_to_gti_comment_mapping(\@source_file_lines, \%source_file_key_to_line_mapping, $translation_file_type);     
     2044        } else { 
     2045            %source_file_key_to_gti_comment_or_last_updated_mapping = &build_key_to_last_update_date_mapping($source_file, \@source_file_lines, \%source_file_key_to_line_mapping, $translation_file_type); 
     2046        } 
     2047 
    20402048        my $target_file = &util::filename_cat($source_file_directory, $interface_file_key."_".$target_language_code.".properties"); 
    20412049        my @target_file_lines = &read_file_lines(&util::filename_cat($gsdl_root_directory, $target_file)); 
    20422050        my %target_file_key_to_line_mapping = &build_key_to_line_mapping(\@target_file_lines, $translation_file_type); 
    20432051        my %target_file_key_to_text_mapping = &build_key_to_text_mapping(\@target_file_lines, \%target_file_key_to_line_mapping, $translation_file_type); 
    2044         my %target_file_key_to_gti_comment_mapping = &build_key_to_gti_comment_mapping(\@target_file_lines, \%target_file_key_to_line_mapping, $translation_file_type); 
     2052        #my %target_file_key_to_gti_comment_mapping = &build_key_to_gti_comment_mapping(\@target_file_lines, \%target_file_key_to_line_mapping, $translation_file_type); 
     2053         
     2054        my %target_file_key_to_gti_comment_or_last_updated_mapping; 
     2055        if($get_gti_comments_not_last_updated) { 
     2056            %target_file_key_to_gti_comment_or_last_updated_mapping = &build_key_to_gti_comment_mapping(\@target_file_lines, \%target_file_key_to_line_mapping, $translation_file_type); 
     2057        } else { 
     2058            %target_file_key_to_gti_comment_or_last_updated_mapping = &build_key_to_last_update_date_mapping($target_file, \@target_file_lines, \%target_file_key_to_line_mapping, $translation_file_type); 
     2059        } 
    20452060         
    20462061         
     
    20592074            my $global_chunk_key = "$interface_file_key.$chunk_key"; 
    20602075            $source_files_key_to_text_mapping->{$global_chunk_key} = $source_file_key_to_text_mapping{$chunk_key}; 
    2061             $source_files_key_to_gti_comment_mapping->{$global_chunk_key} = $source_file_key_to_gti_comment_mapping{$chunk_key}; 
     2076            $source_files_key_to_gti_comment_or_last_updated_mapping->{$global_chunk_key} = $source_file_key_to_gti_comment_or_last_updated_mapping{$chunk_key}; 
    20622077             
    20632078            if (defined $target_file_key_to_text_mapping{$chunk_key}) { 
    20642079                $target_files_key_to_text_mapping->{$global_chunk_key} = $target_file_key_to_text_mapping{$chunk_key}; 
    2065                 $target_files_key_to_gti_comment_mapping->{$global_chunk_key} = $target_file_key_to_gti_comment_mapping{$chunk_key}; 
     2080                $target_files_key_to_gti_comment_or_last_updated_mapping->{$global_chunk_key} = $target_file_key_to_gti_comment_or_last_updated_mapping{$chunk_key}; 
    20662081            } 
    20672082        }