home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 May / PCWorld_2002-05_cd.bin / Software / TemaCD / activetcltk / ActiveTcl8.3.4.1-8.win32-ix86.exe / ActiveTcl8.3.4.1-win32-ix86 / demos / Img / imgmsg.tcl < prev    next >
Encoding:
Text File  |  2001-10-22  |  874 b   |  34 lines

  1. #
  2. #    This script activates msgcat if available, otherwise it
  3. #    defines a minimal number of functions to make Internationalization
  4. #    within Img possible using Tk 8.0 or higher.
  5. #
  6. if {[catch {package require msgcat}]} {
  7.     if {[info exists env(LANG)]} {
  8.     set fileName [file join [file dirname [info script]] msgs \
  9.         [string tolower [string range $env(LANG) 0 1]].msg]
  10.     if {[file readable $fileName]} {
  11.         namespace eval msgcat {
  12.         proc mcset {args} {
  13.             global ::msgs
  14.             if {[llength $args] > 2} {
  15.             set msgs([lindex $args 1]) [lindex $args 2]
  16.             }
  17.         }
  18.         }
  19.         source $fileName
  20.     }
  21.     }
  22.     proc mc {string} {
  23.     global msgs
  24.     if {[info exists msgs($string)]} {
  25.         return [set msgs($string)]
  26.     } else {
  27.         return $string
  28.     }
  29.     }
  30. } else {
  31.     ::msgcat::mcload [file join [file dirname [info script]] msgs]
  32.     catch {namespace import ::msgcat::mc}
  33. }
  34.