Tadashi Okoshi
slash****@users*****
2005年 7月 6日 (水) 02:12:08 JST
Index: affelio/apps/album/Album.pm
diff -u affelio/apps/album/Album.pm:1.14 affelio/apps/album/Album.pm:1.15
--- affelio/apps/album/Album.pm:1.14 Fri Jul 1 11:15:25 2005
+++ affelio/apps/album/Album.pm Wed Jul 6 02:12:08 2005
@@ -21,6 +21,9 @@
use lib '../../extlib';
use lib '../../lib';
+use lib '.';
+use Album::L10N;
+
use DBI;
use Jcode;
use LWP::UserAgent;
@@ -49,6 +52,12 @@
$this->{comment_tb}= "album_$afap->{install_name}_comments";
$this->{dbh} = undef;
# åæå
+
+ ###########################
+ #Locale init
+ ###########################
+ $this->{lh} = Album::L10N->get_handle(($afap->get_site_info("locale"),"en_us"));
+ ###########################
unless(-f $this->{tmpfile}) {
open(TMP,"> $this->{tmpfile}");
@@ -664,4 +673,44 @@
return $query;
}
+
+############################################################################
+#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("Album::translate tag_body = [$tag_body]\n");
+# debug_print("Album::translate \t text=[$text_value]\n");
+# debug_print("Album::translate \t param=[$param_value]\n");
+# debug_print("Album::translate \t sbst=[$sbst]\n");
+
+ $mesg =~ s/\Q<AF_M $tag_body>\E/$sbst/g;
+ }
+ return($mesg);
+}
+############################################################################
+
+
1;
+
+
+
Index: affelio/apps/album/list_album.cgi
diff -u affelio/apps/album/list_album.cgi:1.6 affelio/apps/album/list_album.cgi:1.7
--- affelio/apps/album/list_album.cgi:1.6 Fri Jul 1 11:15:25 2005
+++ affelio/apps/album/list_album.cgi Wed Jul 6 02:12:08 2005
@@ -98,6 +98,7 @@
$tmpl->param(ENTRIES => \@entries_param);
}
-print $tmpl->output;
+#print $tmpl->output;
+print $album->translate_templateL10N( $tmpl->output );
require("./common/footer.pl");