[Richard Suchenwirth] 2002-08-09 - In the [Tcl chatroom] we often notice what difference in greeting a timezone makes: morning in Germany is afternoon in Australia, etc. This brought me to think a little on the algorithm leading to selection of the appropriate greeting. Even just on the examples of English and German I notice that the boundaries appear not to be the same - "good afternoon" just cannot be translated to "guten Nachmittag", it is too un-idiomatic. Contributions for other languages are gladly taken (as usual!-) proc greet'en {} { scan [clock format [clock sec] -format %H] %d hr foreach {maxhr word} { 12 morning 18 afternoon 22 evening 99 night } {if {$hr < $maxhr} break} ;# (1) return "good $word" } proc greet'en-au {} { return "G'day" ;# stevel } proc greet'de {} { scan [clock format [clock sec] -format %H] %d hr foreach {maxhr word} { 11 "n Morgen" 17 "n Tag" 22 "n Abend" 99 " Nacht" } {if {$hr < $maxhr} break} return Gute$word } proc greet'es-ar {} { scan [clock format [clock sec] -format %H] %d hr foreach {maxhr word} { 12 "os d������������������������������������������������������������������as" 19 "as tardes" 99 "as noches" } {if {$hr < $maxhr} break} return buen$word } proc greet'fr {} { scan [clock format [clock sec] -format %H] %d hr foreach {maxhr word} { 19 "jour" 99 "soir" } {if {$hr < $maxhr} break} return bon$word } proc greet'pt {} { scan [clock format [clock sec] -format %H] %d hr foreach {maxhr word} { 12 "bom dia" 19 "boa tarde" 99 "boa noite" } {if {$hr < $maxhr} break} return $word } proc greet'nl {} { scan [clock format [clock sec] -format %H] %d hr foreach {maxhr word} { 12 "goeie morgen" 17 "goeie middag" 99 "goeienavond" } {if {$hr < $maxhr} break} return $word } proc greet'nl_nl_polite {} { scan [clock format [clock sec] -format %H] %d hr foreach {maxhr word} { 12 "goede morgen" 17 "goede middag" 99 "goedenavond" } {if {$hr < $maxhr} break} return $word } proc greet'nl_nl_informal {} { scan [clock format [clock sec] -format %H] %d hr foreach {maxhr word} { 12 "mogge" 17 "middag" 99 "n'avond" } {if {$hr < $maxhr} break} return $word } proc greet'nl_nl_impolite {} { scan [clock format [clock sec] -format %H] %d hr foreach {maxhr word} { 12 "hoi" 17 "hoi" 99 "(silence)" } {if {$hr < $maxhr} break} return $word } ---- % greet'en good afternoon % greet'de Guten Tag ---- (1): [kennykb]: "Good night" is non-idiomatic as a greeting. How about "Good heavens, why are you awake at this hour?" "Good night" would be something that might be used as a farewell though. For a greeting after about 6:00 PM, in my part of the US, you would hear "Good evening!" most frequently. ---- [Natural languages] | [Arts and crafts of Tcl-Tk programming]