gettext: msgfmt Invocation

1 
1 10.1 Invoking the ‘msgfmt’ Program
1 ==================================
1 
1      msgfmt [OPTION] FILENAME.po …
1 
1    The ‘msgfmt’ programs generates a binary message catalog from a
1 textual translation description.
1 
1 10.1.1 Input file location
1 --------------------------
1 
1 ‘FILENAME.po …’
1 
1 ‘-D DIRECTORY’
1 ‘--directory=DIRECTORY’
1      Add DIRECTORY to the list of directories.  Source files are
1      searched relative to this list of directories.  The resulting
1      binary file will be written relative to the current directory,
1      though.
1 
1    If an input file is ‘-’, standard input is read.
1 
1 10.1.2 Operation mode
1 ---------------------
1 
1 ‘-j’
1 ‘--java’
1      Java mode: generate a Java ‘ResourceBundle’ class.
1 
1 ‘--java2’
1      Like –java, and assume Java2 (JDK 1.2 or higher).
1 
1 ‘--csharp’
1      C# mode: generate a .NET .dll file containing a subclass of
1      ‘GettextResourceSet’.
1 
1 ‘--csharp-resources’
1      C# resources mode: generate a .NET ‘.resources’ file.
1 
1 ‘--tcl’
1      Tcl mode: generate a tcl/msgcat ‘.msg’ file.
1 
1 ‘--qt’
1      Qt mode: generate a Qt ‘.qm’ file.
1 
1 ‘--desktop’
1      Desktop Entry mode: generate a ‘.desktop’ file.
1 
1 ‘--xml’
1      XML mode: generate an XML file.
1 
1 10.1.3 Output file location
1 ---------------------------
1 
1 ‘-o FILE’
1 ‘--output-file=FILE’
1      Write output to specified file.
1 
1 ‘--strict’
1      Direct the program to work strictly following the Uniforum/Sun
1      implementation.  Currently this only affects the naming of the
1      output file.  If this option is not given the name of the output
1      file is the same as the domain name.  If the strict Uniforum mode
1      is enabled the suffix ‘.mo’ is added to the file name if it is not
1      already present.
1 
1      We find this behaviour of Sun’s implementation rather silly and so
1      by default this mode is _not_ selected.
1 
1    If the output FILE is ‘-’, output is written to standard output.
1 
1 10.1.4 Output file location in Java mode
1 ----------------------------------------
1 
1 ‘-r RESOURCE’
1 ‘--resource=RESOURCE’
1      Specify the resource name.
1 
1 ‘-l LOCALE’
1 ‘--locale=LOCALE’
1      Specify the locale name, either a language specification of the
1      form LL or a combined language and country specification of the
1      form LL_CC.
1 
1 ‘-d DIRECTORY’
1      Specify the base directory of classes directory hierarchy.
1 
1 ‘--source’
1      Produce a .java source file, instead of a compiled .class file.
1 
1    The class name is determined by appending the locale name to the
1 resource name, separated with an underscore.  The ‘-d’ option is
1 mandatory.  The class is written under the specified directory.
1 
1 10.1.5 Output file location in C# mode
1 --------------------------------------
1 
1 ‘-r RESOURCE’
1 ‘--resource=RESOURCE’
1      Specify the resource name.
1 
1 ‘-l LOCALE’
1 ‘--locale=LOCALE’
1      Specify the locale name, either a language specification of the
1      form LL or a combined language and country specification of the
1      form LL_CC.
1 
1 ‘-d DIRECTORY’
1      Specify the base directory for locale dependent ‘.dll’ files.
1 
1    The ‘-l’ and ‘-d’ options are mandatory.  The ‘.dll’ file is written
1 in a subdirectory of the specified directory whose name depends on the
1 locale.
1 
1 10.1.6 Output file location in Tcl mode
1 ---------------------------------------
1 
1 ‘-l LOCALE’
1 ‘--locale=LOCALE’
1      Specify the locale name, either a language specification of the
1      form LL or a combined language and country specification of the
1      form LL_CC.
1 
1 ‘-d DIRECTORY’
1      Specify the base directory of ‘.msg’ message catalogs.
1 
1    The ‘-l’ and ‘-d’ options are mandatory.  The ‘.msg’ file is written
1 in the specified directory.
1 
1 10.1.7 Desktop Entry mode operations
1 ------------------------------------
1 
1 ‘--template=TEMPLATE’
1      Specify a .desktop file used as a template.
1 
1 ‘-k[KEYWORDSPEC]’
1 ‘--keyword[=KEYWORDSPEC]’
1      Specify KEYWORDSPEC as an additional keyword to be looked for.
1      Without a KEYWORDSPEC, the option means to not use default
1      keywords.
1 
1 ‘-l LOCALE’
1 ‘--locale=LOCALE’
1      Specify the locale name, either a language specification of the
1      form LL or a combined language and country specification of the
1      form LL_CC.
1 
1 ‘-d DIRECTORY’
1      Specify the directory where PO files are read.  The directory must
1      contain the ‘LINGUAS’ file.
1 
1    To generate a ‘.desktop’ file for a single locale, you can use it as
1 follows.
1 
1      msgfmt --desktop --template=TEMPLATE --locale=LOCALE \
1        -o FILE FILENAME.po …
1 
1    msgfmt provides a special "bulk" operation mode to process multiple
1 ‘.po’ files at a time.
1 
1      msgfmt --desktop --template=TEMPLATE -d DIRECTORY -o FILE
1 
1    msgfmt first reads the ‘LINGUAS’ file under DIRECTORY, and then
1 processes all ‘.po’ files listed there.  You can also limit the locales
1 to a subset, through the ‘LINGUAS’ environment variable.
1 
1    For either operation modes, the ‘-o’ and ‘--template’ options are
1 mandatory.
1 
1 10.1.8 XML mode operations
1 --------------------------
1 
1 ‘--template=TEMPLATE’
1      Specify an XML file used as a template.
1 
1 ‘-L NAME’
1 ‘--language=NAME’
1      Specifies the language of the input files.
1 
1 ‘-l LOCALE’
1 ‘--locale=LOCALE’
1      Specify the locale name, either a language specification of the
1      form LL or a combined language and country specification of the
1      form LL_CC.
1 
1 ‘-d DIRECTORY’
1      Specify the base directory of ‘.po’ message catalogs.
1 
1    To generate an XML file for a single locale, you can use it as
1 follows.
1 
1      msgfmt --xml --template=TEMPLATE --locale=LOCALE \
1        -o FILE FILENAME.po …
1 
1    msgfmt provides a special "bulk" operation mode to process multiple
1 ‘.po’ files at a time.
1 
1      msgfmt --xml --template=TEMPLATE -d DIRECTORY -o FILE
1 
1    msgfmt first reads the ‘LINGUAS’ file under DIRECTORY, and then
1 processes all ‘.po’ files listed there.  You can also limit the locales
1 to a subset, through the ‘LINGUAS’ environment variable.
1 
1    For either operation modes, the ‘-o’ and ‘--template’ options are
1 mandatory.
1 
1 10.1.9 Input file syntax
1 ------------------------
1 
1 ‘-P’
1 ‘--properties-input’
1      Assume the input files are Java ResourceBundles in Java
1      ‘.properties’ syntax, not in PO file syntax.
1 
1 ‘--stringtable-input’
1      Assume the input files are NeXTstep/GNUstep localized resource
1      files in ‘.strings’ syntax, not in PO file syntax.
1 
1 10.1.10 Input file interpretation
1 ---------------------------------
1 
1 ‘-c’
1 ‘--check’
1      Perform all the checks implied by ‘--check-format’,
1      ‘--check-header’, ‘--check-domain’.
1 
1 ‘--check-format’
1      Check language dependent format strings.
1 
1      If the string represents a format string used in a ‘printf’-like
1      function both strings should have the same number of ‘%’ format
1      specifiers, with matching types.  If the flag ‘c-format’ or
1      ‘possible-c-format’ appears in the special comment <#,> for this
1      entry a check is performed.  For example, the check will diagnose
1      using ‘%.*s’ against ‘%s’, or ‘%d’ against ‘%s’, or ‘%d’ against
1      ‘%x’.  It can even handle positional parameters.
1 
1      Normally the ‘xgettext’ program automatically decides whether a
1      string is a format string or not.  This algorithm is not perfect,
1      though.  It might regard a string as a format string though it is
1      not used in a ‘printf’-like function and so ‘msgfmt’ might report
1      errors where there are none.
1 
1      To solve this problem the programmer can dictate the decision to
1      the ‘xgettext’ program (⇒c-format).  The translator should
1      not consider removing the flag from the <#,> line.  This "fix"
1      would be reversed again as soon as ‘msgmerge’ is called the next
1      time.
1 
1 ‘--check-header’
11      Verify presence and contents of the header entry.  ⇒Header
      Entry, for a description of the various fields in the header
1      entry.
1 
1 ‘--check-domain’
1      Check for conflicts between domain directives and the
1      ‘--output-file’ option
1 
1 ‘-C’
1 ‘--check-compatibility’
1      Check that GNU msgfmt behaves like X/Open msgfmt.  This will give
1      an error when attempting to use the GNU extensions.
1 
1 ‘--check-accelerators[=CHAR]’
1      Check presence of keyboard accelerators for menu items.  This is
1      based on the convention used in some GUIs that a keyboard
1      accelerator in a menu item string is designated by an immediately
1      preceding ‘&’ character.  Sometimes a keyboard accelerator is also
1      called "keyboard mnemonic".  This check verifies that if the
1      untranslated string has exactly one ‘&’ character, the translated
1      string has exactly one ‘&’ as well.  If this option is given with a
1      CHAR argument, this CHAR should be a non-alphanumeric character and
1      is used as keyboard accelerator mark instead of ‘&’.
1 
1 ‘-f’
1 ‘--use-fuzzy’
1      Use fuzzy entries in output.  Note that using this option is
1      usually wrong, because fuzzy messages are exactly those which have
1      not been validated by a human translator.
1 
1 10.1.11 Output details
1 ----------------------
1 
1 ‘-a NUMBER’
1 ‘--alignment=NUMBER’
1      Align strings to NUMBER bytes (default: 1).
1 
1 ‘--endianness=BYTEORDER’
1      Write out 32-bit numbers in the given byte order.  The possible
1      values are ‘big’ and ‘little’.  The default is ‘little’.
1 
1      MO files of any endianness can be used on any platform.  When a MO
1      file has an endianness other than the platform’s one, the 32-bit
1      numbers from the MO file are swapped at runtime.  The performance
1      impact is negligible.
1 
1      This option can be useful to produce MO files that are optimized
1      for one platform.
1 
1 ‘--no-hash’
1      Don’t include a hash table in the binary file.  Lookup will be more
1      expensive at run time (binary search instead of hash table lookup).
1 
1 10.1.12 Informative output
1 --------------------------
1 
1 ‘-h’
1 ‘--help’
1      Display this help and exit.
1 
1 ‘-V’
1 ‘--version’
1      Output version information and exit.
1 
1 ‘--statistics’
1      Print statistics about translations.  When the option ‘--verbose’
1      is used in combination with ‘--statistics’, the input file name is
1      printed in front of the statistics line.
1 
1 ‘-v’
1 ‘--verbose’
1      Increase verbosity level.
1