message: The 90s called, they want their .phtml extension back
  That and Zend Framework, which uses it for templates. Because this
  extension isn't recognized by xgettext, add a dedicated extra extractor
  pass for .phtml files that uses explicit -L php flag.
diff: @@ -67,7 +67,6 @@ const char * const GETTEXT_EXTENSIONS[] = {
  "pl", "PL", "pm", "perl", /*"cgi" - too generic,*/ // perl
  "php", "php3", "php4", // PHP
  - // NOTE: .phtml shouldn't be used by modern PHP, but maybe it is?
  "py", // Python
  @@ -95,17 +94,9 @@ const char * const GETTEXT_EXTENSIONS[] = {
  /// Extractor implementation for standard GNU gettext
  -class GettextExtractor : public Extractor
  +class GettextExtractorBase : public Extractor
  {
  public:
  - GettextExtractor()
  - {
  - for (const char * const *e = GETTEXT_EXTENSIONS; *e != nullptr; e++)
  - RegisterExtension(*e);
  - }
  -
  - wxString GetId() const override { return "gettext"; }
  -
  wxString Extract(TempDirectory& tmpdir,
  const SourceCodeSpec& sourceSpec,
  const std::vector<wxString>& files) const override
  @@ -144,6 +135,10 @@ public:
  QuoteCmdlineArg(!sourceSpec.Charset.empty() ? sourceSpec.Charset : "UTF-8")
  );
  + auto additional = GetAdditionalFlags();
  + if (!additional.empty())
  + cmdline += " " + additional;
  +
  for (auto& kw: sourceSpec.Keywords)
  {
  cmdline += wxString::Format(" -k%s", QuoteCmdlineArg(kw));
  @@ -167,9 +162,46 @@ public:
  return outfile;
  }
  +
  +protected:
  + virtual wxString GetAdditionalFlags() const = 0;
  +};
  +
  +
  +/// Extractor implementation for standard GNU gettext
  +class GettextExtractor : public GettextExtractorBase
  +{
  +public:
  + GettextExtractor()
  + {
  + for (const char * const *e = GETTEXT_EXTENSIONS; *e != nullptr; e++)
  + RegisterExtension(*e);
  + }
  +
  + wxString GetId() const override { return "gettext"; }
  +
  +protected:
  + wxString GetAdditionalFlags() const override { return ""; }
  };
  +/// Dedicated extractor for .phtml files - PHP, used by Zend Framework
  +class PHTMLGettextExtractor : public GettextExtractorBase
  +{
  +public:
  + PHTMLGettextExtractor()
  + {
  + RegisterExtension("phtml");
  + }
  +
  + wxString GetId() const override { return "gettext-phtml"; }
  +
  +protected:
  + wxString GetAdditionalFlags() const override { return "-L php"; }
  +};
  +
  +
  +
  void Extractor::CreateGettextExtractors(Extractor::ExtractorsList& into)
  {
  into.push_back(std::make_shared<GettextExtractor>());
  