summaryrefslogtreecommitdiff
path: root/po/po2wiki
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-07-20 07:20:13 +0200
committerJoey Hess <joey@gnu.kitenet.net>2009-07-20 07:20:13 +0200
commita7b813182df7d18a0d1bf2fb28b3ee4c069c86e9 (patch)
tree83b7d4840e91e1c3cf2d72b47c01bde4f701d0d2 /po/po2wiki
parente04692e059c41e5616ead2f198ed498ec3a2f290 (diff)
build translated underlays for use with non-English wikis
Diffstat (limited to 'po/po2wiki')
-rwxr-xr-xpo/po2wiki12
1 files changed, 8 insertions, 4 deletions
diff --git a/po/po2wiki b/po/po2wiki
index 031c906cb..6b84f7d54 100755
--- a/po/po2wiki
+++ b/po/po2wiki
@@ -23,15 +23,19 @@ foreach my $file (@$files) {
}
foreach my $ll (keys %{$config{po_slave_languages}}) {
- $config{destdir}="po/out.$ll";
+ $config{destdir}="../underlays/locale/$ll";
foreach my $file (@$files) {
my $page=pagename($file);
my ($masterpage, $lang) = IkiWiki::Plugin::po::_istranslation($page);
next unless defined $lang && $lang eq $ll;
- my $content=readfile(srcfile($file));
- $content=IkiWiki::Plugin::po::po_to_markup($page, $content);
- writefile($masterpage.".".$config{default_pageext}, $config{destdir}, $content);
+ my $content=IkiWiki::Plugin::po::po_to_markup($page, readfile(srcfile($file)));
+ # avoid wasting space if the page is not translated at all
+ my $mastercontent=readfile(srcfile($pagesources{$masterpage}));
+ if ($content ne $mastercontent) {
+ writefile($masterpage.".".$config{default_pageext},
+ $config{destdir}, $content);
+ }
}
}