[JimG] 20050425 I am just starting to learn Tcl. Find it's fun when using Chinese Characters. puts "The next line is in Chinese. Since we don't use blank space to separate words, {}s and \"s are not needed!" puts 中文不用空格来分词,所以句子不需要用引号或者大括号。 set cs 白日依山尽,黄河入海流。欲穷千里目,更上一层楼。 puts [string replace $cs end-5 中文更自由。] It's interesting. There're others to come... [KJN] 2005-05-20 Non-ASCII characters are first-class citizens in Tcl (unlike other languages which "support" Unicode as a kind of optional extra). Tcl is therefore a very good foundation for programming in languages other than English. Variables and commands can be named with non-ASCII characters, for example: set 子 需要用 puts $子 works just fine. Tcl lets you rename and alias commands, so you can also say interp alias {} 用 {} puts 用 $子 or rename puts 用 用 $子 If you wish, you can keep the "English" commands in a different place by renaming them: rename puts en_puts interp alias {} 用 {} en_puts 用 $子 You can do this in a systematic way, by moving the English commands into a namespace. With just an hour's work, it would be possible to translate every Tcl command into a different natural language. Command options are more difficult, but could be translated in a substitute command that then calls the "real" command. The most difficult problem is with error messages: is there an easy way to modify the error messages that Tcl sends? If so, English could be completely replaced with an arbitrary natural language. ---- [wdb] It is doubtlessly big fun to nationalise via [rename] ... but a drawback remains: you cannot do the same to the sub commands, e.g. you cannot rename [string] ''is integer'' to something like German ''zeichenfolge entspricht ganzzahl'' ... possibly a [tip] to improve the command [rename]? [Lars H]: Rather unlikely, in view of how the parsing of subcommands is often hardcoded in C internally. You can however use [namespace ensemble] to "rename" the subcommands: namespace ensemble create -command sträng -map { bytelängd {string bytelength} jämför {string compare} lika {string equal} första {string first} index {string index} är {{sträng är}} sista {string last} längd {string length} avbilda {string map} matchar {string match} intervall {string range} upprepa {string repeat} bytut {string replace} medgemena {string tolower} somititel {string totitle} medversaler {string toupper} beskär {string trim} beskärvänster {string trimleft} beskärhöger {string trimright} ordslut {string wordend} ordbörjan {string wordstart} } namespace ensemble create -command {sträng är} -map { alfanumerisk {string is alnum} bokstäver {string is alpha} ascii {string is ascii} boolesk {string is boolean} styrtecken {string is control} siffror {string is digit} dubbelprecisionsflyttal {string is double} falsk {string is false} synlig {string is graph} heltal {string is integer} gemena {string is lower} skrivbar {string is print} skiljetecken {string is punct} mellanslag {string is space} sann {string is true} versaler {string is upper} ordtecken {string is wordchar} hexsiffror {string is xdigit} } ---- [[ [Category Characters] | [Category Human Language] ]] ---- '''[RAY] - 2009-07-22 10:20:51''' http://www.childbook.com/Fun-with-Chinese-Characters-Volume-2-p/l0102.htm%|%Fun with Chinese Characters%|% the Straits Times Collection is a great book about CHinese Characters.