home *** CD-ROM | disk | FTP | other *** search
/ PCNET 2006 September - Disc 1 / PCNET_CD_2006_09.iso / linux / puppy-barebones-2.01r2.iso / pup_201.sfs / usr / lib / Img1.2 / imgmsg.tcl < prev    next >
Encoding:
Text File  |  2004-05-13  |  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.