FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserPrevious exampleNext example

Using the automatic translation system

This example employs message markup for translation (such as _c, writeln_) and also demnonstrates the use of annotations relating to the handling of messages.

The provided template file translate.pot (Portable Object Template) has been generated with the compilation option '-x':
mosel comp -x translate.mos -o translate.pot
For each supported language a separate PO (Portable Object) file needs to be generated using the xprnls command:
xprnls init -o translate.pot
The resulting PO file needs to be edited, completing its header by specifying the language and the encoding, and entering the desired translations.

Run the command below to generate the dictionaries or message catalogues (*.mo Machine Object files) from the provided translations (*.po files):
xprnls mogen -d locale *.po
The output will be contained in the subdirectory 'locale'.

Further explanation of this example: 'Mosel Language Reference', Section 2.20 Message translation

Source Files
By clicking on a file name, a preview is opened at the bottom of this page.

Data Files


  * Mosel Example Programs                              *
  * ======================                              *
  *                                                     *
  * file tanslate.mos                                   *
  * `````````````````                                   *
  * Example for the use of the Mosel language           *
  * (use of the automatic translation system)           *
  * run the command below to generate the dictionaries: *
  *  xprnls mogen -d locale *.po                        *
  *                                                     *
  * (c) 2015 Fair Isaac Corporation                     *
  *     author: Y. Colombani, 2015                      *

model translate
!@mc.msgdom translate
uses 'mmsystem'
 weekday:array(1..7) of string
 worder:array(1..7) of string
!@mc.msgid yes
!@mc.msgid no
 writeln_("Today is ",_(weekday(wd)))
 writeln_("This is the ",_(worder(wd))," day of the week")

Back to examples browserPrevious exampleNext example