]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/po.pm
use a div, not a p .. and in html5, a nav
[ikiwiki.git] / IkiWiki / Plugin / po.pm
index f8801185e2450152f2155fb01ff1da5fdcee607f..7c979ebca3f88b111fcc10885751e695e937c85e 100644 (file)
@@ -85,7 +85,8 @@ sub getsetup () {
        return
                plugin => {
                        safe => 0,
-                       rebuild => 1,
+                       rebuild => 1, # format plugin
+                       section => "format",
                },
                po_master_language => {
                        type => "string",
@@ -132,6 +133,7 @@ sub checkconfig () {
                                      $field, 'po'));
                }
        }
+       delete $config{po_slave_languages}{$config{po_master_language}{code}};;
 
        map {
                islanguagecode($_)
@@ -173,7 +175,8 @@ sub checkconfig () {
                if ($config{po_master_language}{code} ne 'en') {
                        # Add underlay containing translated source files
                        # for the master language.
-                       add_underlay("locale/$config{po_master_language}{code}/$underlay");
+                       add_underlay("locale/$config{po_master_language}{code}/$underlay")
+                               if -d "$config{underlaydirbase}/locale/$config{po_master_language}{code}/$underlay";
                }
        }
 }
@@ -307,7 +310,7 @@ sub pagetemplate (@) {
        if (ishomepage($page) && $template->query(name => "title")) {
                $template->param(title => $config{wikiname});
        }
-} # }}}
+}
 
 # Add the renamed page translations to the list of to-be-renamed pages.
 sub renamepages (@) {
@@ -564,7 +567,7 @@ sub mybestlink ($$) {
        my $link=shift;
 
        return $origsubs{'bestlink'}->($page, $link)
-               if $config{po_link_to} eq "default";
+               if defined $config{po_link_to} && $config{po_link_to} eq "default";
 
        my $res=$origsubs{'bestlink'}->(masterpage($page), $link);
        my @caller = caller(1);
@@ -582,7 +585,7 @@ sub mybeautify_urlpath ($) {
        my $url=shift;
 
        my $res=$origsubs{'beautify_urlpath'}->($url);
-       if ($config{po_link_to} eq "negotiated") {
+       if (defined $config{po_link_to} && $config{po_link_to} eq "negotiated") {
                $res =~ s!/\Qindex.$config{po_master_language}{code}.$config{htmlext}\E$!/!;
                $res =~ s!/\Qindex.$config{htmlext}\E$!/!;
                map {
@@ -726,6 +729,7 @@ sub istranslatablefile ($) {
        my $type=pagetype($file);
        return 0 if ! defined $type || $type eq 'po';
        return 0 if $file =~ /\.pot$/;
+       return 0 if ! defined $config{po_translatable_pages};
        return 1 if pagespec_match(pagename($file), $config{po_translatable_pages});
        return;
 }