[Affelio-cvs 538] CVS update: affelio/apps/diary

Back to archive index

Tadashi Okoshi slash****@users*****
2005年 7月 6日 (水) 02:30:04 JST


Index: affelio/apps/diary/Diary.pm
diff -u affelio/apps/diary/Diary.pm:1.21 affelio/apps/diary/Diary.pm:1.22
--- affelio/apps/diary/Diary.pm:1.21	Mon Jul  4 14:49:00 2005
+++ affelio/apps/diary/Diary.pm	Wed Jul  6 02:30:03 2005
@@ -20,6 +20,9 @@
 use lib '../../extlib';
 use lib '../../lib';
 
+use lib '.';
+use Diary::L10N;
+
 use DBI;
 use Jcode;
 use LWP::UserAgent;
@@ -47,6 +50,12 @@
 	$self->{recent_entries_no} = 10;
 	$self->{header_title} = 'Affelio Diary';
 	$self->{header_show} = 0;
+
+	###########################
+	#Locale init
+	###########################
+	$self->{lh} = Diary::L10N->get_handle(($afap->get_site_info("locale"),"en_us"));
+	###########################
 	
 	my $DBConfig = Config::Tiny->new();
 	$DBConfig = Config::Tiny->read("$self->{afap}->{af}->{site__user_dir}/db.cfg");
@@ -903,4 +912,40 @@
 	}
 }
 
+############################################################################
+#L10N added by slash
+############################################################################
+sub translate_templateL10N{
+    my $af=shift;
+    my $mesg = shift;
+    
+    my $tag_body ="";
+    my $text_value="";
+    my $param_value="";
+    
+    while( $mesg =~ /<AF_M ([^>]+)>/ ){
+	$tag_body = $1;
+	
+	$tag_body =~ /text(\s*)=(\s*)["']([^"']*)["'](\s*)param(\s*)=(\s*)["']([^"']*)["']/;
+	$text_value=$3;
+	$param_value=$7;
+	if($text_value eq ""){
+	    $tag_body =~ /text(\s*)=(\s*)["']([^"']*)["']/;
+	    $text_value=$3;
+	}
+	
+	my $sbst = $af->{lh}->maketext($text_value, $param_value);
+	
+#	debug_print("Diary::translate tag_body = [$tag_body]\n");
+#	debug_print("Diary::translate \t text=[$text_value]\n");
+#	debug_print("Diary::translate \t param=[$param_value]\n");
+#	debug_print("Diary::translate \t sbst=[$sbst]\n");
+	
+	$mesg =~ s/\Q<AF_M $tag_body>\E/$sbst/g;
+    }
+    return($mesg);
+}
+############################################################################
+
+
 1;


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