8 my @po_list = `ls *.po`;
11 my $dest_char1 = "\\\\\"";
12 my $dest_char2 = "\\\"";
13 my $quatation_char = "\"";
19 my @po_file_line = $po_file;
21 foreach (@po_file_line) {
22 tie my @filearray, 'Tie::File', $_ or die "Couldn't open file $_, $!";
23 foreach my $line(@filearray) {
24 if (($line =~ /msgstr\ \"(.*)\"/)) {
28 # there is no qutation, continue
29 if (index($new_line, "\"") != -1) {
30 printf "replace: $new_line\n";
32 $new_line =~ s/$dest_char1/$quatation_char/g;
35 $new_line =~ s/$quatation_char/$dest_char2/g;
38 $line = "msgstr\ \"$new_line\"";
49 my @po_file_line = $po_file;
51 foreach (@po_file_line) {
52 tie my @filearray, 'Tie::File', $_ or die "Couldn't open file $_, $!";
53 foreach my $line(@filearray) {
54 if (($line =~ /msgstr\ \"(.*)\"/)) {
57 if (index($new_line, "\\") != -1) {
58 printf "replace: $new_line\n";
60 # replace \n with <br>
61 $new_line =~ s/\\/ /g;
64 $line = "msgstr\ \"$new_line\"";
75 my @po_file_line = $po_file;
77 foreach (@po_file_line) {
78 tie my @filearray, 'Tie::File', $_ or die "Couldn't open file $_, $!";
79 foreach my $line(@filearray) {
80 if (($line =~ /msgstr\ \"(.*)\"/)) {
83 if (index($new_line, "<br>") != -1) {
84 printf "replace: $new_line\n";
86 # replace <br> with \n
87 $new_line =~ s/<br>/\\n/g;
90 $line = "msgstr\ \"$new_line\"";
98 sub replace_driver_str
101 my @po_file_line = $po_file;
103 foreach (@po_file_line) {
104 tie my @filearray, 'Tie::File', $_ or die "Couldn't open file $_, $!";
105 foreach my $line(@filearray) {
106 if (($line =~ /msgstr\ \"(.*)\"/)) {
109 if (index($new_line, ":\\") != -1) {
110 printf "replace: $new_line\n";
112 if( index($new_line, ":\\\\") == -1 ) {
113 # replace <br> with \n
114 $new_line =~ s/:\\/:\\\\/g;
117 $line = "msgstr\ \"$new_line\"";
130 replace_quatation($file);
131 replace_driver_str($file);
132 #replace_another($file);