gettext: Tcl

1 
1 15.5.17 Tcl - Tk’s scripting language
1 -------------------------------------
1 
1 RPMs
1      tcl
1 
1 File extension
1      ‘tcl’
1 
1 String syntax
1      ‘"abc"’
1 
1 gettext shorthand
1      ‘[_ "abc"]’
1 
1 gettext/ngettext functions
1      ‘::msgcat::mc’
1 
1 textdomain
1      —
1 
1 bindtextdomain
1      —, use ‘::msgcat::mcload’ instead
1 
1 setlocale
1      automatic, uses LANG, but ignores LC_MESSAGES and LC_ALL
1 
1 Prerequisite
1      ‘package require msgcat’
1      ‘proc _ {s} {return [::msgcat::mc $s]}’
1 
1 Use or emulate GNU gettext
1      —, uses a Tcl specific message catalog format
1 
1 Extractor
1      ‘xgettext -k_’
1 
1 Formatting with positions
1      ‘format "%2\$d %1\$d"’
1 
1 Portability
1      fully portable
1 
1 po-mode marking
1      —
1 
1    Two examples are available in the ‘examples’ directory: ‘hello-tcl’,
1 ‘hello-tcl-tk’.
1 
1    Before marking strings as internationalizable, substitutions of
1 variables into the string need to be converted to ‘format’ applications.
1 For example, ‘"file $filename not found"’ becomes ‘[format "file %s not
1 found" $filename]’.  Only after this is done, can the strings be marked
1 and extracted.  After marking, this example becomes ‘[format [_ "file %s
1 not found"] $filename]’ or ‘[msgcat::mc "file %s not found" $filename]’.
1 Note that the ‘msgcat::mc’ function implicitly calls ‘format’ when more
1 than one argument is given.
1