manpagez: man pages & more
info gettext
Home | html | info | man

File: gettext.info,  Node: msgpre Invocation,  Next: spit Invocation,  Prev: Installing an LLM,  Up: Pretranslating

8.2 Invoking the ‘msgpre’ Program
=================================

     msgpre [OPTION...]

   The ‘msgpre’ program pretranslates a translation catalog.

   *Warning:* The pretranslations might not be what you expect.  They
might be of the wrong form, be of poor quality, or reflect some biases.

8.2.1 Input file location
-------------------------

‘-i INPUTFILE’
‘--input=INPUTFILE’
     Input PO file.

‘-D DIRECTORY’
‘--directory=DIRECTORY’
     Add DIRECTORY to the list of directories.  Source files are
     searched relative to this list of directories.  The resulting ‘.po’
     file will be written relative to the current directory, though.

   If no INPUTFILE is given or if it is ‘-’, standard input is read.

8.2.2 Output file location
--------------------------

‘-o FILE’
‘--output-file=FILE’
     Write output to specified file.

   The results are written to standard output if no output file is
specified or if it is ‘-’.

8.2.3 Message selection
-----------------------

‘--keep-fuzzy’
     Keep fuzzy messages unmodified.  Pretranslate only untranslated
     messages.

8.2.4 Large Language Model (LLM) options
----------------------------------------

‘--species=TYPE’
     Specifies the type of Large Language Model execution engine.  The
     default and only valid value is ‘ollama’.

‘--url=URL’
     Specifies the URL of the server that runs Large Language Model
     execution engine.  For ‘ollama’, the default is
     ‘http://localhost:11434’.

‘-m MODEL’
‘--model=MODEL’
     Specifies the model to use.  This option is mandatory; no default
     exists.  The specified model must already be installed in the Large
     Language Model execution engine.

‘--prompt=TEXT’
     Specifies the prompt to use before each ‘msgid’ from the PO file.
     It allows you to specify extra instructions for the LLM. The prompt
     should include an instruction like "Translate into TARGET
     LANGUAGE.".  Some hints for good prompts are described in the
     article "How to write AI prompts for translation"
     .

‘--postprocess=COMMAND’
     Specifies a command to post-process the output from the LLM. This
     should be a Bourne shell command that reads from standard input and
     writes to standard output.

     For instance, the ‘ministral-3:14b’ model often emphasizes part of
     the output with ‘**’ characters.  To eliminate these markers, you
     could use the command ‘sed -e 's/[*][*]//g'’.

8.2.5 Input file syntax
-----------------------

‘-P’
‘--properties-input’
     Assume the input file is a Java ResourceBundle in Java
     ‘.properties’ syntax, not in PO file syntax.

‘--stringtable-input’
     Assume the input file is a NeXTstep/GNUstep localized resource file
     in ‘.strings’ syntax, not in PO file syntax.

8.2.6 Output details
--------------------

‘--color’
‘--color=WHEN’
     Specify whether or when to use colors and other text attributes.
     See *note The --color option:: for details.

‘--style=STYLE_FILE’
     Specify the CSS style rule file to use for ‘--color’.  See *note
     The --style option:: for details.

‘--force-po’
     Always write an output file even if it contains no message.

‘--indent’
     Write the .po file using indented style.

‘--no-location’
     Do not write ‘#: FILENAME:LINE’ lines.

‘-n’
‘--add-location=TYPE’
     Generate ‘#: FILENAME:LINE’ lines (default).

     The optional TYPE can be either ‘full’, ‘file’, or ‘never’.  If it
     is not given or ‘full’, it generates the lines with both file name
     and line number.  If it is ‘file’, the line number part is omitted.
     If it is ‘never’, it completely suppresses the lines (same as
     ‘--no-location’).

‘--strict’
     Write out a strict Uniforum conforming PO file.  Note that this
     Uniforum format should be avoided because it doesn't support the
     GNU extensions.

‘-p’
‘--properties-output’
     Write out a Java ResourceBundle in Java ‘.properties’ syntax.  Note
     that this file format doesn't support plural forms and silently
     drops obsolete messages.

‘--stringtable-output’
     Write out a NeXTstep/GNUstep localized resource file in ‘.strings’
     syntax.  Note that this file format doesn't support plural forms.

‘-w NUMBER’
‘--width=NUMBER’
     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
     NUMBER.

‘--no-wrap’
     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.

‘-s’
‘--sort-output’
     Generate sorted output.  Note that using this option makes it much
     harder for the translator to understand each message's context.

‘-F’
‘--sort-by-file’
     Sort output by file location.

8.2.7 Informative output
------------------------

‘-h’
‘--help’
     Display this help and exit.

‘-V’
‘--version’
     Output version information and exit.

‘-q’
‘--quiet’
‘--silent’
     Suppress progress indicators.

8.2.8 Examples
--------------

   To pretranslate the file ‘foo.po’:

     msgpre --model=ministral-3:14b < foo.po > foo-pretranslated.po

Note that this command can take a long time, depending on the model and
the available hardware.

© manpagez.com 2000-2026
Individual documents may contain additional copyright information.