@c This file is part of the GNU gettext manual. @c Copyright (C) 1995-2020 Free Software Foundation, Inc. @c See the file gettext.texi for copying conditions. @node Tcl @subsection Tcl - Tk's scripting language @cindex Tcl @cindex Tk's scripting language @table @asis @item RPMs tcl @item Ubuntu packages tcl @item File extension @code{tcl} @item String syntax @code{"abc"} @item gettext shorthand @code{[_ "abc"]} @item gettext/ngettext functions @code{::msgcat::mc} @item textdomain --- @item bindtextdomain ---, use @code{::msgcat::mcload} instead @item setlocale automatic, uses LANG, but ignores LC_MESSAGES and LC_ALL @item Prerequisite @code{package require msgcat} @*@code{proc _ @{s@} @{return [::msgcat::mc $s]@}} @item Use or emulate GNU gettext ---, uses a Tcl specific message catalog format @item Extractor @code{xgettext -k_} @item Formatting with positions @code{format "%2\$d %1\$d"} @item Portability fully portable @item po-mode marking --- @end table Two examples are available in the @file{examples} directory: @code{hello-tcl}, @code{hello-tcl-tk}. Before marking strings as internationalizable, substitutions of variables into the string need to be converted to @code{format} applications. For example, @code{"file $filename not found"} becomes @code{[format "file %s not found" $filename]}. Only after this is done, can the strings be marked and extracted. After marking, this example becomes @code{[format [_ "file %s not found"] $filename]} or @code{[msgcat::mc "file %s not found" $filename]}. Note that the @code{msgcat::mc} function implicitly calls @code{format} when more than one argument is given.