Changeset 12484


Ignore:
Timestamp:
2006-08-18T17:07:45+12:00 (18 years ago)
Author:
mdewsnip
Message:

The username of the person who did the translations is now recorded in the "Updated" comment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/gti.pl

    r12483 r12484  
    409409    # The key of the file to translate (ensure it is lowercase)
    410410    my $translation_file_key = lc(shift(@_));
     411    # The username of the translation submitter
     412    my $submitter_username = shift(@_);
    411413    # Whether to submit a target chunk even if it hasn't changed
    412414    my $force_submission_flag = shift(@_);
    413415
    414416    # Check that the necessary arguments were supplied
    415     if (!$target_language_code || !$translation_file_key) {
     417    if (!$target_language_code || !$translation_file_key || !$submitter_username) {
    416418    &log_message("Fatal error (but cannot be thrown): Missing command argument.");
    417419    die "\n";
     
    524526    if ($force_submission_flag || $target_file_key_to_submission_mapping{$chunk_key} ne $target_file_key_to_text_mapping{$chunk_key}) {
    525527        $target_file_key_to_text_mapping{$chunk_key} = $target_file_key_to_submission_mapping{$chunk_key};
    526         $target_file_key_to_gti_comment_mapping{$chunk_key} = "Updated $submission_date";
     528        $target_file_key_to_gti_comment_mapping{$chunk_key} = "Updated $submission_date by $submitter_username";
    527529    }
    528530    }
     
    954956
    955957    # Check for an "Updated DD-MMM-YYYY" comment at the end of the chunk
    956     if ($chunk_text =~ /\#\s+(Updated\s+\d?\d-\D\D\D-\d\d\d\d)\s*$/i) {
     958    if ($chunk_text =~ /\#\s+(Updated\s+\d?\d-\D\D\D-\d\d\d\d.*)\s*$/i) {
    957959    return $1;
    958960    }
     
    11211123    $chunk_text =~ s/^(\S+?):(\s*)//;
    11221124    $chunk_text =~ s/(\s*)$//;  # Remove any nasty whitespace, carriage returns etc.
    1123     $chunk_text =~ s/(\s*)\#\s+Updated\s+(\d?\d-\D\D\D-\d\d\d\d)\s*$//i;
     1125    $chunk_text =~ s/(\s*)\#\s+Updated\s+(\d?\d-\D\D\D-\d\d\d\d.*)\s*$//i;
    11241126
    11251127    return $chunk_text;
     
    11321134
    11331135    # Check for an "Updated DD-MMM-YYYY" comment at the end of the chunk
    1134     if ($chunk_text =~ /\#\s+(Updated\s+\d?\d-\D\D\D-\d\d\d\d)\s*$/i) {
     1136    if ($chunk_text =~ /\#\s+(Updated\s+\d?\d-\D\D\D-\d\d\d\d.*)\s*$/i) {
    11351137    return $1;
    11361138    }
     
    12201222        my $chunk_key = $1;
    12211223        $line =~ s/\s*$//;  # Remove any nasty whitespace
    1222         $line =~ s/<Updated date=\"\d?\d-\D\D\D-\d\d\d\d\"\/>$//;
     1224        $line =~ s/<Updated date=\"\d?\d-\D\D\D-\d\d\d\d.*\"\/>$//;
    12231225
    12241226        # While there is still text of the string to go...
     
    12311233        $line = $file_lines[$i];
    12321234        $line =~ s/\s*$//;  # Remove any nasty whitespace
    1233         $line =~ s/<Updated date=\"\d?\d-\D\D\D-\d\d\d\d\"\/>$//;
     1235        $line =~ s/<Updated date=\"\d?\d-\D\D\D-\d\d\d\d.*\"\/>$//;
    12341236        }
    12351237
     
    12541256    # Simple: just remove the Text tags
    12551257    $chunk_text =~ s/^\s*<Text id=\"(.*?)\">(\s*)//;
    1256     $chunk_text =~ s/<Updated date=\"\d?\d-\D\D\D-\d\d\d\d\"\/>$//;
     1258    $chunk_text =~ s/<Updated date=\"\d?\d-\D\D\D-\d\d\d\d.*\"\/>$//;
    12571259    $chunk_text =~ s/<\/Text>$//;
    12581260
     
    12661268
    12671269    # Check for an "Updated DD-MMM-YYYY" comment at the end of the chunk
    1268     if ($chunk_text =~ /<Updated date=\"(\d?\d-\D\D\D-\d\d\d\d)\"\/>$/i) {
     1270    if ($chunk_text =~ /<Updated date=\"(\d?\d-\D\D\D-\d\d\d\d.*)\"\/>$/i) {
    12691271    return $1;
    12701272    }
     
    13301332    print TARGET_FILE "<Text id=\"$chunk_key\">$target_file_chunk_text</Text>";
    13311333    if ($target_file_key_to_gti_comment_mapping->{$chunk_key}) {
    1332         print TARGET_FILE "<Updated date=\"" . $target_file_key_to_gti_comment_mapping->{$chunk_key} . "\"\/>";
     1334        my $chunk_gti_comment = $target_file_key_to_gti_comment_mapping->{$chunk_key};
     1335        $chunk_gti_comment =~ s/^Updated //;
     1336        print TARGET_FILE "<Updated date=\"" . $chunk_gti_comment . "\"\/>";
    13331337    }
    13341338    print TARGET_FILE "\n";
Note: See TracChangeset for help on using the changeset viewer.