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