X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/27071f0ba9c0204980f3ab8c188ebb6319483851..83480665c256a344900fc817bcb4618f8db9aeee:/IkiWiki/Plugin/po.pm diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 22ad8a7f9..e9dc9dd8c 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -827,8 +827,23 @@ sub refreshpofiles ($@) { foreach my $pofile (@pofiles) { IkiWiki::prep_writefile(basename($pofile),dirname($pofile)); + + if (! -e $pofile) { + # If the po file exists in an underlay, copy it + # from there. + my ($pobase)=$pofile=~/^\Q$config{srcdir}\E\/?(.*)$/; + foreach my $dir (@{$config{underlaydirs}}) { + if (-e "$dir/$pobase") { + File::Copy::syscopy("$dir/$pobase",$pofile) + or error("po(refreshpofiles) ". + sprintf(gettext("failed to copy underlay PO file to %s"), + $pofile)); + } + } + } + if (-e $pofile) { - system("msgmerge", "-q", "-U", "--backup=none", $pofile, $potfile) == 0 + system("msgmerge", "--previous", "-q", "-U", "--backup=none", $pofile, $potfile) == 0 or error("po(refreshpofiles) ". sprintf(gettext("failed to update %s"), $pofile));