_s returns a translated string for an English string. If a translation is not available the function returns the English string. So far the only available language is German. A Japanese translation will soon be available.

ssMessage = _s(ssID)

Return Value

ssMessage is the translated string in the selected language. If the translation is not available the ssID string (English) is returned.



ssID the English string being translated.


UniPlot uses the GNU gettext toolset (http://www.gnu.org/software/gettext/gettext.html).


// test.ic
def test_error_msg(file, line_no)
    printf(_s("Error occurred in file %s, line %d\n"), file, line_no);

The xgettext GNU program extracts translatable strings from given input files:

xgettext.exe --add-comments=// --no-wrap -s -k_s --language=c test.ic

The program creates a PO file messages.po, Example:

#: test.ic:4
#, c-format
msgid "Error occurred in file %s, line %d\n"
msgstr ""

Comment lines starting with #. The untranslated string starts with msgid. This field msgstr will be empty and must be translated into the target language, for example German:

#: test.ic:4
#, c-format
msgid "Error occurred in file %s, line %d\n"
msgstr "Fehler in Datei %s aufgetreten, Zeile %d\n"

UniPlot will not use the PO files directly. The files are converted to binary files using the MapSave function. All strings of one language are saved in one file uniplot.umo in the sub-folder program\locale\<loc>. <loc> is the language id, for example en, de or ja.

The function i18n_umo_to_po(ssUMO, ssPO) can be used to convert UMO files to PO files. For example, to convert the German UMO file to a PO file type in the following command into the command window:

i18n_umo_to_po(GetRootDirectory() + "program\\locale\\de\\uniplot.umo", "d:\\uniplot-de.po")

You can open the PO file with UniPlot or with Poedit (http://www.poedit.net/screenshots.php). The UniPlot PO file contains approx. 3000 messages.

You can use the UniPlot Editor to add a new entry at the end of the file:

#: test.ic:4
#, c-format
msgid "Error occurred in file %s, line %d\n"
msgstr "Fehler in Datei %s aufgetreten, Zeile %d\n"

To convert a PO file into a UMO file type in the following command:

i18n_po_to_umo("d:\\uniplot-de.po", GetRootDirectory() + "program\\locale\\de\\uniplot.umo")

You need write access for you UniPlot directory.

Because the update UMO file will be loaded at startup, restart UniPlot after you updated the PO file and type in the following command:

_s("Error occurred in file %s, line %d\n")

The return value is:

"Fehler in Datei %s aufgetreten, Zeile %d\n"

Some Hints:

  • The characters behind the comment character # have the following meaning:

    #  translator-comments
    #. extracted-comments
    #: reference...
    #, flag...
    #~ msgid previous-untranslated-string
    msgid untranslated-string
    msgstr translated-string
  • The first, empty msgid key "" contains information about the PO file:

    msgid ""
    msgstr "Project-Id-Version: UniPlot\n"
    "POT-Creation-Date: 2009-12-11 10:27+0100\n"
    "PO-Revision-Date: 2012-12-30 13:21+0100\n"
    "Last-Translator: Roman Brüggenkoch <rb@uniplot.de>\n"
    "Language-Team: R. & S. Brüggenkoch <sb@uniplot.de>\n"
    "MIME-Version: 1.0\n"
    "Content-Type: text/plain; charset=UTF-8\n"
    "Content-Transfer-Encoding: 8bit\n"
    "Language: de_DE\n"

    An important entry is "Content-Type: text/plain; charset=UTF-8\n". This entry specifies that the charset=UTF-8 has to be used.

  • Long strings in msgid and msgstr can be split in multiple lines Example:

    msgstr "Dies ist ein langer String"
    msgstr "Dies ist ein "
    "langer String"
    msgstr "Dies ist ein "
           "langer Stri"
    msgstr "Dies ist ein"
           " langer Stri"
  • Quotes, backslashes, tab or new line characters in PO files must be specified as in the programming language C: " \" \\ \t \n ".

  • Some of the msgids contain strings enclosed in $-charactes, e. g. “$d/conf$Help System”. This is only a context information and should not be translated.

    msgid "$d/conf$Help System"
    msgstr "Hilfe System"
  • If a string contains C format strings like %s or %d, for example "Error occurred in file %s, line %d\n". The order of the format strings should not be alterd in the translation. The translation “Fehler in Datei %s aufgetreten, Zeile %dn”` is correct, "Fehler in Zeile %d der Datei %s aufgetreten\n" is incorrect.

  • Beside the file uniplot.umo, the locale directory C:\Program Files (x86)\UniPlot Software\R2013\Program\locale\de\ contains a second text file with the name id. The German file looks like this:

    de,0x07,Deutsch (de)

    A Japanese id file would look like this:

    ja, 0x11, Japanese (ja)


    ja, 0x11, 日本人 (ja)

    The file contains three elements separated by a comma “,”. Language code, Primary Language ID, Display-String.

  • The display language can be changed in Tools=>Options.

  • To open two UniPlot instances simultaneously with different languages create a copy of the UniPlot desktop icon and open the Properties dialog box (right click):


    Modify the Target and add the switch /user e. g. C:\Program Files (x86)\UniPlot Software\R2013\Program\x64\uniplot.exe /user english. Start the UniPlot using the new Icon and open Tools=>Options to select the new language.

  • Beside the UMO file, UniPlot uses RC files (Resource files) for translation dialogs, menus and message strings. You will find these files in Samples\SDK\i18n.


Version Description
R2013 (5.50) Documentation updated.
3.0 New