]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/po.pm
po: new po_translation_status_in_links option
[git.ikiwiki.info.git] / IkiWiki / Plugin / po.pm
index 9aefe236f6a076fee3b58fdeb2dfbcce7f865623..33bc2b0577153b20815fb4dd1b8e9519b7972be5 100644 (file)
@@ -110,6 +110,13 @@ sub getsetup () { #{{{
                        safe => 1,
                        rebuild => 1,
                },
+               po_translation_status_in_links => {
+                       type => "boolean",
+                       example => 1,
+                       description => "display translation status in links to translations",
+                       safe => 1,
+                       rebuild => 1,
+               },
 } #}}}
 
 sub checkconfig () { #{{{
@@ -144,6 +151,10 @@ sub checkconfig () { #{{{
                warn(gettext('po_link_to=negotiated requires usedirs to be enabled, falling back to po_link_to=default'));
                $config{po_link_to}='default';
        }
+       if (! exists $config{po_translation_status_in_links} ||
+           ! defined $config{po_translation_status_in_links}) {
+               $config{po_translation_status_in_links}=1;
+       }
        push @{$config{wiki_file_prune_regexps}}, qr/\.pot$/;
 } #}}}
 
@@ -492,7 +503,8 @@ sub mynicepagetitle ($;$) { #{{{
 
        my $res = $origsubs{'nicepagetitle'}->($page, $unescaped);
        return $res unless istranslation($page);
-       return $res." (".percenttranslated($page).")";
+       return $res unless $config{po_translation_status_in_links};
+       return $res.' ('.percenttranslated($page).' %)';
 } #}}}
 
 # ,----