]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Merge remote-tracking branch 'intrigeri/po'
authorJoey Hess <joey@kitenet.net>
Fri, 3 Jun 2011 16:36:30 +0000 (12:36 -0400)
committerJoey Hess <joey@kitenet.net>
Fri, 3 Jun 2011 16:36:30 +0000 (12:36 -0400)
1  2 
IkiWiki/Plugin/po.pm

diff --combined IkiWiki/Plugin/po.pm
index d3a996a2189fd24c007ea4127ed0a56faf9d7c8b,ec58c515b7d5136ff2811e68969e6167bac2d692..aca3d4bf86cf52afbe517ef43f83fdbc731a0eee
@@@ -31,7 -31,6 +31,7 @@@ my @origneedsbuild
  my %origsubs;
  my @slavelanguages; # language codes ordered as in config po_slave_languages
  my %slavelanguages; # language code to name lookup
 +my $language_code_pattern = '[a-zA-Z]+(?:_[a-zA-Z]+)?';
  
  memoize("istranslatable");
  memoize("_istranslation");
@@@ -812,7 -811,7 +812,7 @@@ sub _istranslation ($) 
                         && pagetype($file) eq 'po';
        return 0 if $file =~ /\.pot$/;
  
 -      my ($masterpage, $lang) = ($page =~ /(.*)[.]([a-z]{2})$/);
 +      my ($masterpage, $lang) = ($page =~ /(.*)[.]($language_code_pattern)$/);
        return 0 unless defined $masterpage && defined $lang
                         && length $masterpage && length $lang
                         && defined $pagesources{$masterpage}
@@@ -854,7 -853,7 +854,7 @@@ sub lang ($) 
  sub islanguagecode ($) {
        my $code=shift;
  
 -      return $code =~ /^[a-z]{2}$/;
 +      return $code =~ /^$language_code_pattern$/;
  }
  
  sub otherlanguage_page ($$) {
@@@ -1246,6 -1245,7 +1246,7 @@@ sub po4a_options($) 
                # how to disable options is not consistent across po4a modules
                $options{includessi} = '';
                $options{includeexternal} = 0;
+               $options{ontagerror} = 'warn';
        }
        elsif ($pagetype eq 'mdwn') {
                $options{markdown} = 1;
  sub splitlangpair ($) {
        my $pair=shift;
  
 -      my ($code, $name) = ( $pair =~ /^([a-z]{2})\|(.+)$/ );
 +      my ($code, $name) = ( $pair =~ /^($language_code_pattern)\|(.+)$/ );
        if (! defined $code || ! defined $name ||
            ! length $code || ! length $name) {
                # not a fatal error to avoid breaking if used with web setup