]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/po.pm
Don't memoize ensure_committer
[git.ikiwiki.info.git] / IkiWiki / Plugin / po.pm
index 26c6463dabf5705eeb870f2b44bfa51e1cafed59..6b55ee35133e66a33f24710248b2afa666618189 100644 (file)
@@ -346,6 +346,12 @@ sub pagetemplate (@) {
        if ($template->query(name => "lang_code")) {
                $template->param(lang_code => $lang_code);
        }
+       if ($template->query(name => "html_lang_code")) {
+               $template->param(html_lang_code => htmllangcode($lang_code));
+       }
+       if ($template->query(name => "html_lang_dir")) {
+               $template->param(html_lang_dir => htmllangdir($lang_code));
+       }
        if ($template->query(name => "lang_name")) {
                $template->param(lang_name => languagename($lang_code));
        }
@@ -857,6 +863,19 @@ sub lang ($) {
        return $master_language_code;
 }
 
+sub htmllangcode ($) {
+       (my $lang = shift) =~ tr/_/-/;
+       return $lang;
+}
+
+sub htmllangdir ($) {
+       my $lang = shift;
+       if ($lang =~ /^(ar|fa|he)/) {
+               return 'rtl';
+       }
+       return 'ltr';
+}
+
 sub islanguagecode ($) {
        my $code=shift;
 
@@ -974,10 +993,9 @@ sub refreshpofiles ($@) {
                }
 
                if (-e $pofile) {
-                       system("msgmerge", "--previous", "-q", "-U", "--backup=none", $pofile, $potfile) == 0
-                               or error("po(refreshpofiles) ".
-                                        sprintf(gettext("failed to update %s"),
-                                                $pofile));
+                       if (! (system("msgmerge", "--previous", "-q", "-U", "--backup=none", $pofile, $potfile) == 0)) {
+                               print STDERR ("po(refreshpofiles) ". sprintf(gettext("failed to update %s"), $pofile));
+                       }
                }
                else {
                        File::Copy::syscopy($potfile,$pofile)
@@ -1053,6 +1071,8 @@ sub otherlanguagesloop ($) {
                push @ret, {
                        url => urlto_with_orig_beautiful_urlpath(masterpage($page), $page),
                        code => $master_language_code,
+                       html_code => htmllangcode($master_language_code),
+                       html_dir => htmllangdir($master_language_code),
                        language => $master_language_name,
                        master => 1,
                };
@@ -1063,6 +1083,8 @@ sub otherlanguagesloop ($) {
                push @ret, {
                        url => urlto_with_orig_beautiful_urlpath($otherpage, $page),
                        code => $lang,
+                       html_code => htmllangcode($lang),
+                       html_dir => htmllangdir($lang),
                        language => languagename($lang),
                        percent => percenttranslated($otherpage),
                }
@@ -1102,7 +1124,7 @@ sub deletetranslations ($) {
                        IkiWiki::rcs_remove($_);
                }
                else {
-                       IkiWiki::prune("$config{srcdir}/$_");
+                       IkiWiki::prune("$config{srcdir}/$_", $config{srcdir});
                }
        } @todelete;