[Po4a-commits] "po4a/lib/Locale/Po4a Xml.pm,1.84,1.85"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Fri Jan 30 21:51:49 UTC 2009


Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory alioth:/tmp/cvs-serv17119/lib/Locale/Po4a

Modified Files:
	Xml.pm 
Log Message:
	* lib/Locale/Po4a/Xml.pm (get_translate_options): Add a cache to
	store the get_translate_options() results.


Index: Xml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Xml.pm,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- Xml.pm	30 Jan 2009 21:49:11 -0000	1.84
+++ Xml.pm	30 Jan 2009 21:51:47 -0000	1.85
@@ -1083,9 +1083,15 @@
 #   p: a placeholder shall replace the tag (and its content)
 #
 # A translatable inline tag in an untranslated tag is treated as a translatable breaking tag.
+my %translate_options_cache;
 sub get_translate_options {
 	my $self = shift;
 	my $path = shift;
+
+	if (defined $translate_options_cache{$path}) {
+		return $translate_options_cache{$path};
+	}
+
 	my $options = "";
 	my $translate = 0;
 	my $usedefault = 1;
@@ -1161,6 +1167,7 @@
 		}
 	}
 
+	$translate_options_cache{$path} = $options;
 	return $options;
 }
 




More information about the Po4a-commits mailing list