5

I am new using xgettext command. So I don't know what am I doing wrong.

I put the command:

xgettext -n *.php -o --output='/home/public/sample'

in my script, but I get an error:

xgettext: cannot create output file "--output=/home/public/sample": No such file or directory`

But when I run xgettext -n *.php - messages.po file gets created in my current directory! Is there a way to specify the location where to create messages.po file?

Radu Rădeanu
  • 174,089
  • 51
  • 332
  • 407
John
  • 53

1 Answers1

3

If you want to write the output of xgettext to a specified file, use or -o, or --output, no both of them in the same time (in your case, xgettext will "think" to save the output in --output='/home/public/sample' which obviously can't be a file).

So, this will be correct:

xgettext -n *.php -o '/path/to/output_file'

which is equivalent with:

xgettext -n *.php --output='/path/to/output_file'

If you want that the output files to be placed in a specific directory, use:

xgettext -n *.php -p '/path/to/output_dir'

or, equivalent:

xgettext -n *.php --output-dir='/path/to/output_dir'

Also, be sure that /path/to/output_file file or /path/to/output_dir directory exists.

See also man xgettext.

Radu Rădeanu
  • 174,089
  • 51
  • 332
  • 407