]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
response
[ikiwiki.git] / IkiWiki.pm
index 41276e118bafbf96064f4286562021d3c7640e60..43ef67e8c9ce6ea4824977528a602533962cd47c 100644 (file)
@@ -816,13 +816,15 @@ sub file_pruned ($$) { #{{{
        $file =~ m/$regexp/;
 } #}}}
 
+my $gettext_obj;
 sub gettext { #{{{
        # Only use gettext in the rare cases it's needed.
-       # This overrides future calls of this function.
        if (exists $ENV{LANG} || exists $ENV{LC_ALL} || exists $ENV{LC_MESSAGES}) {
-               eval q{use Locale::gettext};
-               textdomain('ikiwiki');
-               return Locale::gettext::gettext(shift);
+               if (! $gettext_obj) {
+                       eval q{use Locale::gettext ''};
+                       $gettext_obj=Locale::gettext->domain('ikiwiki');
+               }
+               return $gettext_obj->get(shift);
        }
        else {
                return shift;