@c This file is part of the GNU gettext manual.
@c Copyright (C) 1995-2019 Free Software Foundation, Inc.
@c See the file gettext.texi for copying conditions.

@pindex msgattrib
@cindex @code{msgattrib} program, usage
@example
msgattrib [@var{option}] [@var{inputfile}]
@end example

@cindex filter messages according to attributes
@cindex attribute manipulation
The @code{msgattrib} program filters the messages of a translation catalog
according to their attributes, and manipulates the attributes.

@subsection Input file location

@table @samp
@item @var{inputfile}
Input PO file.

@item -D @var{directory}
@itemx --directory=@var{directory}
@opindex -D@r{, @code{msgattrib} option}
@opindex --directory@r{, @code{msgattrib} option}
Add @var{directory} to the list of directories.  Source files are
searched relative to this list of directories.  The resulting @file{.po}
file will be written relative to the current directory, though.

@end table

If no @var{inputfile} is given or if it is @samp{-}, standard input is read.

@subsection Output file location

@table @samp
@item -o @var{file}
@itemx --output-file=@var{file}
@opindex -o@r{, @code{msgattrib} option}
@opindex --output-file@r{, @code{msgattrib} option}
Write output to specified file.

@end table

The results are written to standard output if no output file is specified
or if it is @samp{-}.

@subsection Message selection

@table @samp
@item --translated
@opindex --translated@r{, @code{msgattrib} option}
Keep translated messages, remove untranslated messages.

@item --untranslated
@opindex --untranslated@r{, @code{msgattrib} option}
Keep untranslated messages, remove translated messages.

@item --no-fuzzy
@opindex --no-fuzzy@r{, @code{msgattrib} option}
Remove
@ifhtml
‘fuzzy’
@end ifhtml
@ifnothtml
`fuzzy'
@end ifnothtml
marked messages.

@item --only-fuzzy
@opindex --only-fuzzy@r{, @code{msgattrib} option}
Keep
@ifhtml
‘fuzzy’
@end ifhtml
@ifnothtml
`fuzzy'
@end ifnothtml
marked messages, remove all other messages.

@item --no-obsolete
@opindex --no-obsolete@r{, @code{msgattrib} option}
Remove obsolete #~ messages.

@item --only-obsolete
@opindex --only-obsolete@r{, @code{msgattrib} option}
Keep obsolete #~ messages, remove all other messages.

@end table

@subsection Attribute manipulation

@cindex modify message attributes
Attributes are modified after the message selection/removal has been
performed.  If the @samp{--only-file} or @samp{--ignore-file} option is
specified, the attribute modification is applied only to those messages
that are listed in the @var{only-file} and not listed in the
@var{ignore-file}.

@table @samp
@item --set-fuzzy
@opindex --set-fuzzy@r{, @code{msgattrib} option}
Set all messages
@ifhtml
‘fuzzy’.
@end ifhtml
@ifnothtml
`fuzzy'.
@end ifnothtml

@item --clear-fuzzy
@opindex --clear-fuzzy@r{, @code{msgattrib} option}
Set all messages
@ifhtml
non-‘fuzzy’.
@end ifhtml
@ifnothtml
non-`fuzzy'.
@end ifnothtml

@item --set-obsolete
@opindex --set-obsolete@r{, @code{msgattrib} option}
Set all messages obsolete.

@item --clear-obsolete
@opindex --clear-obsolete@r{, @code{msgattrib} option}
Set all messages non-obsolete.

@item --previous
@opindex --previous@r{, @code{msgattrib} option}
When setting
@ifhtml
‘fuzzy’
@end ifhtml
@ifnothtml
`fuzzy'
@end ifnothtml
mark, keep ``previous msgid'' of translated messages.

@item --clear-previous
@opindex --clear-previous@r{, @code{msgattrib} option}
Remove the ``previous msgid'' (@samp{#|}) comments from all messages.

@item --empty
@opindex --empty@r{, @code{msgattrib} option}
When removing
@ifhtml
‘fuzzy’
@end ifhtml
@ifnothtml
`fuzzy'
@end ifnothtml
mark, also set msgstr empty.

@item --only-file=@var{file}
@opindex --only-file@r{, @code{msgattrib} option}
Limit the attribute changes to entries that are listed in @var{file}.
@var{file} should be a PO or POT file.

@item --ignore-file=@var{file}
@opindex --ignore-file@r{, @code{msgattrib} option}
Limit the attribute changes to entries that are not listed in @var{file}.
@var{file} should be a PO or POT file.

@item --fuzzy
@opindex --fuzzy@r{, @code{msgattrib} option}
Synonym for @samp{--only-fuzzy --clear-fuzzy}: It keeps only the fuzzy
messages and removes their
@ifhtml
‘fuzzy’
@end ifhtml
@ifnothtml
`fuzzy'
@end ifnothtml
mark.

@item --obsolete
@opindex --obsolete@r{, @code{msgattrib} option}
Synonym for @samp{--only-obsolete --clear-obsolete}: It keeps only the
obsolete messages and makes them non-obsolete.

@end table

@subsection Input file syntax

@table @samp
@item -P
@itemx --properties-input
@opindex -P@r{, @code{msgattrib} option}
@opindex --properties-input@r{, @code{msgattrib} option}
Assume the input file is a Java ResourceBundle in Java @code{.properties}
syntax, not in PO file syntax.

@item --stringtable-input
@opindex --stringtable-input@r{, @code{msgattrib} option}
Assume the input file is a NeXTstep/GNUstep localized resource file in
@code{.strings} syntax, not in PO file syntax.

@end table

@subsection Output details

@c --no-escape and --escape omitted on purpose.  They are not useful.

@table @samp
@item --color
@itemx --color=@var{when}
@opindex --color@r{, @code{msgattrib} option}
Specify whether or when to use colors and other text attributes.
See @ref{The --color option} for details.

@item --style=@var{style_file}
@opindex --style@r{, @code{msgattrib} option}
Specify the CSS style rule file to use for @code{--color}.
See @ref{The --style option} for details.

@item --force-po
@opindex --force-po@r{, @code{msgattrib} option}
Always write an output file even if it contains no message.

@item -i
@itemx --indent
@opindex -i@r{, @code{msgattrib} option}
@opindex --indent@r{, @code{msgattrib} option}
Write the .po file using indented style.

@item --no-location
@opindex --no-location@r{, @code{msgattrib} option}
Do not write @samp{#: @var{filename}:@var{line}} lines.

@item -n
@itemx --add-location=@var{type}
@opindex -n@r{, @code{msgattrib} option}
@opindex --add-location@r{, @code{msgattrib} option}
Generate @samp{#: @var{filename}:@var{line}} lines (default).

The optional @var{type} can be either @samp{full}, @samp{file}, or
@samp{never}.  If it is not given or @samp{full}, it generates the
lines with both file name and line number.  If it is @samp{file}, the
line number part is omitted.  If it is @samp{never}, it completely
suppresses the lines (same as @code{--no-location}).

@item --strict
@opindex --strict@r{, @code{msgattrib} option}
Write out a strict Uniforum conforming PO file.  Note that this
Uniforum format should be avoided because it doesn't support the
GNU extensions.

@item -p
@itemx --properties-output
@opindex -p@r{, @code{msgattrib} option}
@opindex --properties-output@r{, @code{msgattrib} option}
Write out a Java ResourceBundle in Java @code{.properties} syntax.  Note
that this file format doesn't support plural forms and silently drops
obsolete messages.

@item --stringtable-output
@opindex --stringtable-output@r{, @code{msgattrib} option}
Write out a NeXTstep/GNUstep localized resource file in @code{.strings} syntax.
Note that this file format doesn't support plural forms.

@item -w @var{number}
@itemx --width=@var{number}
@opindex -w@r{, @code{msgattrib} option}
@opindex --width@r{, @code{msgattrib} option}
Set the output page width.  Long strings in the output files will be
split across multiple lines in order to ensure that each line's width
(= number of screen columns) is less or equal to the given @var{number}.

@item --no-wrap
@opindex --no-wrap@r{, @code{msgattrib} option}
Do not break long message lines.  Message lines whose width exceeds the
output page width will not be split into several lines.  Only file reference
lines which are wider than the output page width will be split.

@item -s
@itemx --sort-output
@opindex -s@r{, @code{msgattrib} option}
@opindex --sort-output@r{, @code{msgattrib} option}
Generate sorted output.  Note that using this option makes it much harder
for the translator to understand each message's context.

@item -F
@itemx --sort-by-file
@opindex -F@r{, @code{msgattrib} option}
@opindex --sort-by-file@r{, @code{msgattrib} option}
Sort output by file location.

@end table

@subsection Informative output

@table @samp
@item -h
@itemx --help
@opindex -h@r{, @code{msgattrib} option}
@opindex --help@r{, @code{msgattrib} option}
Display this help and exit.

@item -V
@itemx --version
@opindex -V@r{, @code{msgattrib} option}
@opindex --version@r{, @code{msgattrib} option}
Output version information and exit.

@end table
