Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - English


tbx_build_localization

Builds or updates localization .po and .mo files of a toolbox

Syntax

tbx_build_localization()
tbx_build_localization(tbx_path)
tbx_build_localization(tbx_name)               // obsolete
tbx_build_localization(tbx_name, tbx_path)     // obsolete

Arguments

tbx_path

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

tbx_name (deprecated)

Name of the toolbox, use to name localization files and domain.

The name of the toolbox is now retrieved as the basename of the file tbx_path/etc/*.start. This file must be available, even if it is empty.

Description

tbx_build_localization(…) calls tbx_generate_pofile(…) to create the ~/locales/en_US.po reference file, or to updated all existing ~/locales/*.po files.

*.po files -- one for each language -- are text editable files where reference english messages used when calling gettext(domain, "The message") are listed. Below each reference message (msgid), the translated version is provided. As an example, here is a sample of a fr_FR.po file (with extra comments):

#: ~\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.

For more details about how .po files are built, please refer to the tbx_generate_pofile page.

Then, for each language * defined for the toolbox, ~/locales/*/LC_MESSAGES/*.mo files are built from translated messages. *.mo files are binary files used by gettext(msgid) at call time to quickly get the translation.

Examples

tbx_make  SCI/contrib/toolbox_skeleton  localization

is equivalent to

tbx_build_localization  SCI/contrib/toolbox_skeleton
--> tbx_build_localization  SCI/contrib/toolbox_skeleton
WARNING: tbx_build_localization (toolbox_skeleton\locales\):
WARNING:    - The msgid have been updated in *.po files.
WARNING:    - fr_FR.po : 0 untranslated messages.

Generating localization
-- Building for "en_US" --
-- Building for "fr_FR" --

See also

  • tbx_make . localization — Builds fully or some given sections of a toolbox having a standard structure
  • tbx_generate_pofile — Extracts gettext msgid strings from the toolbox source files. Creates/updates .po files
  • addlocalizationdomain — add a new domain in localization mechanism.
  • gettext — indexes or/and translates some indexed english messages

History

VersionDescription
5.5.0 Function tbx_build_localization added.
6.0.0 tbx_name is no longer required.
2023.0.0 Existing .po files are now automatically updated for every newly detected msgid.
Report an issue
<< tbx_build_loader Sections builders tbx_build_src >>

Copyright (c) 2022-2024 (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:
Thu Oct 24 11:13:15 CEST 2024