From 001567d8622547168a1944b353e6b0c88cc79298 Mon Sep 17 00:00:00 2001 From: elserj Date: Tue, 16 Dec 2014 23:34:40 +0000 Subject: [PATCH] Fix split on tab svn path=/; revision=594 --- interactome_scripts/po_insert_translations.pl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/interactome_scripts/po_insert_translations.pl b/interactome_scripts/po_insert_translations.pl index 4c542e4..818e4d5 100755 --- a/interactome_scripts/po_insert_translations.pl +++ b/interactome_scripts/po_insert_translations.pl @@ -20,6 +20,9 @@ if($lang eq "SP") { $line_end = "(Spanish)\" EXACT Spanish [POC:Maria_Alejandra_Gandolfo]"; }elsif($lang eq "JP") { $line_end = "(Japanese)\" EXACT Japanese [NIG:Yukiko_Yamazaki]"; +}else{ + print "Please choose either SP (for Spanish) or JP (for Japanese)"; + exit; } my %lang_hash; @@ -28,7 +31,10 @@ open(language_File,"$trans_file"); while() { my $line = $_; chomp $line; - my ($term, $name, $translation, $defn) = split("\t", $line); + my ($term, $name, $translation, $defn) = split(/\t/, $line); + if ($translation eq "") { + next; + } $translation =~ s/\"//g; if(defined($lang_hash{$term})) { $lang_hash{$term} = "$lang_hash{$term}\t$translation"; @@ -128,11 +134,11 @@ while() { # put in section to deal with Japanese chars. # Japanese characters are utf-8, and should come after the ascii chars of spanish - if ($line_prev =~ m/^synonym:/ && $count_after) { + if ($line_prev =~ m/^synonym:/ && $count_after && $lang eq "JP") { if(defined($lang_hash{$po_id})) { foreach my $new_synonym(split("\t",$lang_hash{$po_id})) { my $new_synonym_line = "synonym: \"$new_synonym $line_end"; - print output_File "$new_synonym_line\n"; + print output_File "$new_synonym_line\n"; } } } -- 2.34.1