tbx_generate_pofile
Extracts gettext msgid strings from the toolbox source files. Creates/updates .po files
Syntax
pofile = tbx_generate_pofile() pofile = tbx_generate_pofile(tbx_path) pofile = tbx_generate_pofile(tbx_name) // obsolete pofile = tbx_generate_pofile(tbx_name, tbx_path) // obsolete
Arguments
- tbx_path
path of the toolbox, use to locate files to compile.
- tbx_name (obsolete)
name of the toolbox, use to name localization files and domain.
tbx_name
is now retrieved as the basename of the filetbx_path/etc/*.start
. This file must exist, even if it is empty.- pofile
return the generated po file path.
Description
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.
Translators are expected to edit #: ~\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. |
Examples
See also
- gettext — indexes or/and translates some indexed english messages
- addlocalizationdomain — add a new domain in localization mechanism.
- tbx_make . localization — Builds fully or some given sections of a toolbox having a standard structure
- tbx_build_localization — Builds or updates localization .po and .mo files of a toolbox
History
バージョン | 記述 |
5.5.0 | Function tbx_generate_pofile added. |
6.0.0 | tbx_name declared obsolete. It is no longer required. |
6.0.1 |
|
2023.0.0 | Existing .po files are now automatically updated for every newly detected msgid. |
Report an issue | ||
<< tbx_builder_src_lang | Helper functions | tbx_make >> |