Changeset 12484 for trunk/gsdl/bin/script/gti.pl
- Timestamp:
- 2006-08-18T17:07:45+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/bin/script/gti.pl
r12483 r12484 409 409 # The key of the file to translate (ensure it is lowercase) 410 410 my $translation_file_key = lc(shift(@_)); 411 # The username of the translation submitter 412 my $submitter_username = shift(@_); 411 413 # Whether to submit a target chunk even if it hasn't changed 412 414 my $force_submission_flag = shift(@_); 413 415 414 416 # 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) { 416 418 &log_message("Fatal error (but cannot be thrown): Missing command argument."); 417 419 die "\n"; … … 524 526 if ($force_submission_flag || $target_file_key_to_submission_mapping{$chunk_key} ne $target_file_key_to_text_mapping{$chunk_key}) { 525 527 $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"; 527 529 } 528 530 } … … 954 956 955 957 # 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) { 957 959 return $1; 958 960 } … … 1121 1123 $chunk_text =~ s/^(\S+?):(\s*)//; 1122 1124 $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; 1124 1126 1125 1127 return $chunk_text; … … 1132 1134 1133 1135 # 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) { 1135 1137 return $1; 1136 1138 } … … 1220 1222 my $chunk_key = $1; 1221 1223 $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.*\"\/>$//; 1223 1225 1224 1226 # While there is still text of the string to go... … … 1231 1233 $line = $file_lines[$i]; 1232 1234 $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.*\"\/>$//; 1234 1236 } 1235 1237 … … 1254 1256 # Simple: just remove the Text tags 1255 1257 $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.*\"\/>$//; 1257 1259 $chunk_text =~ s/<\/Text>$//; 1258 1260 … … 1266 1268 1267 1269 # 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) { 1269 1271 return $1; 1270 1272 } … … 1330 1332 print TARGET_FILE "<Text id=\"$chunk_key\">$target_file_chunk_text</Text>"; 1331 1333 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 . "\"\/>"; 1333 1337 } 1334 1338 print TARGET_FILE "\n";
Note:
See TracChangeset
for help on using the changeset viewer.