[Miranda-jp-cvs] commit-notify[25] add header processing

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2012年 4月 24日 (火) 19:58:06 JST


Revision: 25
          http://sourceforge.jp/projects/miranda-jp/svn/view?view=rev&revision=25
Author:   taguchi-ch
Date:     2012-04-24 19:58:06 +0900 (Tue, 24 Apr 2012)
Log Message:
-----------
add header processing

Modified Paths:
--------------
    trunk/miranda-tools/lpgen/lplink.pl

-------------- next part --------------
Modified: trunk/miranda-tools/lpgen/lplink.pl
===================================================================
--- trunk/miranda-tools/lpgen/lplink.pl	2012-04-19 13:38:51 UTC (rev 24)
+++ trunk/miranda-tools/lpgen/lplink.pl	2012-04-24 10:58:06 UTC (rev 25)
@@ -3,7 +3,23 @@
 # Thie Script generate a new file included all translation using existing langpack_*.
 # Words in langpack_* will overwrite the previously saved words in langDB.
 #
+# Copyright 2012 Miranda JP project.
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
+
 use POSIX;
 use strict;
 use warnings;
@@ -18,6 +34,8 @@
 
 #Get words from exited langDB.
 my $key = '';
+my %headers;
+my @headers = ("Miranda Language Pack","Language:","Locale:","Authors:","Author-email:","Last-Modified-Using:","Plugins-included:","; Generated by lpgen on","; Translations:");
 my %trans;
 
 if ( open my $fh, '<', $langDB_file )
@@ -25,6 +43,14 @@
 	while( my $get_line = <$fh>)
 	{
 		chomp $get_line;
+		foreach my $header ( @headers )
+		{
+			if( $get_line =~ /^$header/)
+			{
+				$headers{$header} = $get_line;
+				next;
+			}
+		}
 		if( $get_line =~ /^\[(.*?)\]$/ )
 		{
 			$key = $get_line;
@@ -44,6 +70,14 @@
 	while( my $get_line = <$fh>)
 	{
 		chomp $get_line;
+		foreach my $header ( @headers )
+		{
+			if( $get_line =~ /^$header/)
+			{
+				$headers{$header} = $get_line;
+				next;
+			}
+		}
 		if( $get_line =~ /^\[(.*?)\]$/ )
 		{
 			$key = $get_line;
@@ -63,6 +97,11 @@
 open my $fh1, '>', $temp_file
 	or die qq/Error : Cannot open "$temp_file": $!/;
 
+foreach my $header (@headers)
+{
+	printf $fh1 "%s\n", $headers{$header};
+}
+print $fh1 "\n";
 foreach my $keyword (@keywords)
 {
 	printf $fh1 "%s\n%s\n", $keyword, $trans{$keyword};



Miranda-jp-cvs メーリングリストの案内
Back to archive index