App-Chart

 view release on metacpan or  search on metacpan

inc/MyMakeMakerGettext.pm  view on Meta::CPAN


# Each po/XX.po is msgmerged from the .pot, and generates a .mo under
# LocaleData.
#
HERE

  foreach my $i (0 .. $#po_files) {
    my $pofile = $po_files[$i];
    my $mofile = $mo_files[$i];
    my $modir = File::Basename::dirname($mofile);

    $ret .= <<"HERE";
$pofile: \$(POT_FILE)
	msgmerge --verbose --update \$@ \$<
	touch \$@
$mofile: $pofile
	mkdir -p $modir
	msgfmt --check --statistics --verbose -o \$@ \$<
HERE
  }

  my $devnull = File::Spec->devnull;
  $ret .= <<"HERE";
# $devnull included in case \$(PO_FILES) is empty
check-fuzzy-po:
	if grep -n fuzzy $devnull \$(PO_FILES); then \\
	  echo "Fuzzy entries in po file(s)"; \\
	  exit 1; \\
	else \\
	  exit 0; \\
	fi
HERE

  return $ret;
}

sub author_sans_email {
  my ($makemaker) = @_;
  my $author = $makemaker->{'AUTHOR'};
  # MakeMaker broke compatibility by changing AUTHOR from string to array.
  if (ref $author) {
    $author = $author->[0];
  }
  $author =~ s/\s*<.*>//;
  return $author;
}

# not used ...
#
# # cf String::ShellQuote
# sub shell_quote {
#   my ($str) = @_;
#   $str =~ s/[\\']/\\$1/;
#   return "'$str'";
# }

# this didn't work, or something ...
#
# sub MY::special_targets {
#   my $makemaker = shift;
#   my $inherited = $makemaker->SUPER::special_targets(@_);
#   $inherited =~ s/^\.SUFFIXES *:/$& .mo .po/
#     or die "Oops, couldn't add to .SUFFIXES";
# #   $inherited =~ s/^\.PHONY *:/$& mo pot/
# #     or die "Oops, couldn't add to .PHONY";
#   return $inherited;
# }

1;
__END__



( run in 1.664 second using v1.01-cache-2.11-cpan-98e64b0badf )