0

Within my php framework (CakePHP), is a i18n tool for generating POT files. The header of the file is generated like so:

protected function _writeHeader() {
    $output = "# LANGUAGE translation of CakePHP Application\n";
    $output .= "# Copyright YEAR NAME <EMAIL@ADDRESS>\n";
    $output .= "#\n";
    $output .= "#, fuzzy\n";
    $output .= "msgid \"\"\n";
    $output .= "msgstr \"\"\n";
    $output .= "\"Project-Id-Version: PROJECT VERSION\\n\"\n";
    $output .= "\"POT-Creation-Date: " . date("Y-m-d H:iO") . "\\n\"\n";
    $output .= "\"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\\n\"\n";
    $output .= "\"Last-Translator: NAME <EMAIL@ADDRESS>\\n\"\n";
    $output .= "\"Language-Team: LANGUAGE <EMAIL@ADDRESS>\\n\"\n";
    $output .= "\"MIME-Version: 1.0\\n\"\n";
    $output .= "\"Content-Type: text/plain; charset=utf-8\\n\"\n";
    $output .= "\"Content-Transfer-Encoding: 8bit\\n\"\n";
    $output .= "\"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\\n\"\n\n";
    return $output;
}

I am curious to know if the following:

$output .= "#, fuzzy\n";
$output .= "msgid \"\"\n";
$output .= "msgstr \"\"\n";

breaks some sort of standards of gettext. If it does not, I would love an explanation as to why one would put that in the header of the file.

Angel S. Moreno
  • 3,469
  • 3
  • 29
  • 40

1 Answers1

1

I suppose it's 'fuzzy' because the headers are not complete. i.e. the template entries will be filled in when the PO files are generated from the POT.

The official Gettext xgettext tool that generates POT files from source code also adds the fuzzy flag to the header. By that token it is certainly not against the standard.

Tim
  • 8,036
  • 2
  • 36
  • 52
  • Ah, I see. Makes perfect sense. what about the msgid and msgstr, should those be there? – Angel S. Moreno Jun 23 '13 at 18:52
  • I just install Ubuntu and searched for examples. I do see the msgid and msgstr in the header and blank. – Angel S. Moreno Jun 23 '13 at 19:11
  • 1
    Thank apparently blank `msgstr ""` actually indicates a multi-line entry. i.e. the entire header block is a single entry in the file with an empty `msgid` and a multi-line `msgstr`. I was confused by this when I first saw a PO file. It took me a while to work that out. – Tim Jun 24 '13 at 09:09