Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 5911675de0cf7e21912b1fe9bbe276b84ca8a9f8
Ticket: 219105ffffffffffffffffffffffffffffffffff
msgcat::unknown should have args, too
User & Date: nobody on 2000-10-26 01:10:52
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 5984 Bug
    Version: 8.4a1
    SubmitDate: '2000-07-06'
    LastModified: '2000-07-06'
    Severity: MED
    Status: Released
    Submitter: techsupp
    ChangedBy: ericm
    OS: Linux-SuSE
    FixedDate: '2000-07-06'
    FixedInVersion: 8.4a2
    ClosedDate: '2000-10-25'
    
    
    Name:
    
    Christian Krone
    
    
    
    Comments:
    
    The comment in msgcat.tcl above the mcunknown command suggests, that
    
        users of the msgcat package
    
        can write their own mcunknown proc. So calling this function with
    
        additional arguments can
    
        generate errors, if someone really created an own version with the old
    
        interface.
    
        
    
        But I think, this should be no problem, since the additional arguments
    
        are only given to mcunknown
    
        if they are specified for mc. And only user who knows about the
    
        additional argument will do so.
    
    
    
    DesiredBehavior:
    
    It's great, that the msgcat::mc command has got an additional args argument.
    
    This way I don't need no longer do the format one layer above by myself.
    
    
    
    But it is essential for me, that the msgcat::mcunknown proc gets the
    
    additional argument, too. Otherwise I have to make a msgfile for the C locale,
    
    which contains only translations from the format strings into itself.
    
    
    
    Patch:
    
    *** msgcat.tcl.orgTue Apr 11 23:16:18 2000
    
    --- msgcat.tclWed Jul  5 17:57:46 2000
    
    ***************
    
    *** 67,73 ****
    
          }
    
          # we have not found the translation
    
          return [uplevel 1 [list [namespace origin mcunknown] \
    
    !     $::msgcat::locale $src]]
    
      }
    
      
    
      # msgcat::mclocale --
    
    --- 67,73 ----
    
          }
    
          # we have not found the translation
    
          return [uplevel 1 [list [namespace origin mcunknown] \
    
    !     $::msgcat::locale $src] $args]
    
      }
    
      
    
      # msgcat::mclocale --
    
    ***************
    
    *** 170,185 ****
    
      #be found for a string.  This routine is intended to be replaced
    
      #by an application specific routine for error reporting
    
      #purposes.  The default behavior is to return the source string.  
    
      #
    
      # Arguments:
    
      #localeThe current locale.
    
      #srcThe string to be translated.
    
      #
    
      # Results:
    
      #Returns the translated value.
    
      
    
    ! proc msgcat::mcunknown {locale src} {
    
    !     return $src
    
      }
    
      
    
      # Initialize the default locale
    
    --- 170,192 ----
    
      #be found for a string.  This routine is intended to be replaced
    
      #by an application specific routine for error reporting
    
      #purposes.  The default behavior is to return the source string.  
    
    + #If additional args are specified, the format command will be used
    
    + #to work them into the traslated string.
    
      #
    
      # Arguments:
    
      #localeThe current locale.
    
      #srcThe string to be translated.
    
    + #argsArgs to pass to the format command
    
      #
    
      # Results:
    
      #Returns the translated value.
    
      
    
    ! proc msgcat::mcunknown {locale src args} {
    
    !     if {[llength $args]} {
    
    ! return [eval {format $src} $args]
    
    !     } else {
    
    ! return $src
    
    !     }
    
      }
    
      
    
      # Initialize the default locale
    
    *** msgcat.test.orgWed Jul  5 18:11:21 2000
    
    --- msgcat.testWed Jul  5 12:58:43 2000
    
    ***************
    
    *** 401,406 ****
    
    --- 401,409 ----
    
      test msgcat-7.3 {::msgcat::mc, errors from format are propagated} {
    
          catch {::msgcat::mc format3 "good test"}
    
      } 1
    
    + test msgcat-7.4 {::msgcat::mc, extra args are given to unknown} {
    
    +     ::msgcat::mc "this is a %s" "good test"
    
    + } "this is a good test"
    
      
    
      # Reset the locale
    
      ::msgcat::mclocale $oldlocale
    
    
    
    PatchFiles:
    
    msgcat.tcl
    
        msgcat.test
    
    
    
    
    
    Thanks for the great patch; I've applied it to the sources in CVS, and this fix will go out with Tcl/Tk 8.4a2.
    
       Eric Melski                            The Other Tcl Guy
       ericm at ajubasolutions.com            Ajuba Solutions
    
    -- 07/06/2000 ericm
    
    
    
  4. foundin changed to: "obsolete: 8.4a1"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "69. Other"
  10. title changed to: "msgcat::unknown should have args, too"
  11. type changed to: "RFE"