Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2023.0.0 - Русский


Extracts gettext msgid strings from the toolbox source files. Creates/updates .po files


pofile = tbx_generate_pofile()
pofile = tbx_generate_pofile(tbx_path)



path of the toolbox, use to locate files to compile.


return the generated po file path.


tbx_generate_pofile(…) scans all toolbox source files for every call to gettext(domain,msgid), _(domain,msgid), (or _d(domain,msgid) in XML files like the preferences file, if any). Then, ~ being the toolbox root directory:

  • If the ~/locales/en_US.po reference file does not exist yet, it is created.

  • Otherwise, all existing ~/locales/*.po files are updated with gettext msgid strings newly detected in all source files of the toolbox. Note: presently, obsolete msgids (no longer present in any source file) are kept.

For each processed .po file (but en_US.po), the number of messages whose translation is still missing is displayed.

Translators are expected to edit ~/locales/*.po files for their language, and write in msgstr strings the translation of the related msgid given in english as appearing as gettext() argument in source files. Here is a sample of a fr_FR.po file:

#: ~\macros\scilab_add.sci:13       << file:line_number places where gettext() is called for the msgid.
#: ~\macros\scilab_error.sci:22     << The same message is used in another file. etc.
msgid "New message #2.\n"           << gettext() argument = reference message (english)
msgstr "Nouveau message n° 2.\n"    << translated message (entered by a translator).

#: ~\macros\scilab_add.sci:16
msgid "New message #3.\n"
msgstr ""                            << Missing translation, to complete.


path = TMPDIR + "/example";
copyfile(SCI+"/contrib/toolbox_skeleton", path);


See also

  • gettext — индексирует или/и переводит некоторые индексированные сообщения на английском языке
  • addlocalizationdomain — add a new domain in localization mechanism.
  • tbx_make . localization — Builds a toolbox having a standard structure (EXPERIMENTAL)
  • tbx_build_localization — Builds or updates localization .po and .mo files of a toolbox


5.5.0 Function tbx_generate_pofile added.
6.0.0 tbx_name declared obsolete. It is no longer required.
  • _() and gettext() references are now detected.
  • Literal double '' are now simplified in the msgid.
  • Files paths in comments are no longer absolute and refer to the toolbox root.
6.1.2 Existing .po files are now automatically updated for every newly detected msgid.
2023.0.0 tbx_name input argument removed.
Report an issue
<< tbx_builder_src_lang Helper functions tbx_make >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Mar 07 09:29:08 CET 2023