Skip to content
Tcl Source Code History Of Ticket 219053ffffffffffffffffffffffffffffffffff
Login

History Of Ticket 219053ffffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 219053ffffffffffffffffffffffffffffffffff

  1. Ticket change [af1504daa7] (rid 97746) by nobody on 2000-10-26 01:09:57:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 4158 Bug
      Version: 8.3
      SubmitDate: '2000-02-11'
      LastModified: '2000-04-11'
      Severity: CRIT
      Status: Released
      Submitter: sven
      ChangedBy: ericm
      RelatedBugIDs: 2211
      OS: All
      FixedDate: '2000-04-11'
      FixedInVersion: 8.3.1
      ClosedDate: '2000-10-25'
      
      
      When using ::msgcat::mc, strings are only resolved by looking at catalog files that have been loaded from inside the current namespace. This means that we need a message catalog directory for each namespace (or have a lot of redundancy by loading the shared catalog file into each namespace).
      
      Expected behavior:
      It would be nice if we could make the ::msgcat::mc command reslove the string by looking at alternative namespaces too. One possibility would be to check the root namespace :: if the string can not be resolved locally, another approach would be to go up the namespace chain, and check on each level.
      
      
      
      If we are to do this, it should check the local namespace and then
      the global namespace, making it the same as proc and variable name
      resolution. 
      -- 04/03/2000 hobbs
      
      I have a solution that checks all the parent namespaces and then the global namespace.  It is not that often that people have namespaces deeper than 2 or 3, so I don't think it's a big deal to check all of them, but we can take that out if people want...  My solution also enables msgcat to do string formatting rather for you.  For example,
      
      ::msgcat::mcset en badUserGroupCombo  {Expected \"%1$s\" to be a user and \"%2$s\" to be a group.}
      
      ::msgcat::mc badUserGroupCombo userA userB
      ==> Expected "userA" to be a user and "userB" to be a group.
      
      # msgcat::mc --
      #
      #Find the translation for the given string based on the current
      #locale setting.  Check the local namespace first, then look in each
      #parent namespace until the source is found.  If additional args are
      #specified, use the format command to work them into the traslated
      #string.
      #
      # Arguments:
      #srcThe string to translate.
      #argsArgs passed the format command.
      #
      # Results:
      #Returns the translated string.
      #Propages errors thrown by the format command.
      
      proc msgcat::mc {src args} {
          # Check for the src in each namespace starting from the local and ending
          # in the global.
      
          set ns [uplevel {namespace current}]
      
          while {![string equal $ns ""]} {
      foreach loc $::msgcat::loclist {
          if {[info exists ::msgcat::msgs($loc,$ns,$src)]} {
      if {[llength $args] == 0} {
          return $::msgcat::msgs($loc,$ns,$src)
      } else {
          return [eval format  [list $::msgcat::msgs($loc,$ns,$src)] $args]
      }
          }
      }
      set ns [namespace parent $ns]
          }
      
          # we have not found the translation
          return [uplevel 1 [list [namespace origin mcunknown]  $::msgcat::locale $src]]
      }
      
      -- 04/07/2000 hershey
      
      I applied this patch and added tests and docs for it (shame on you for not submitting tests and docs yourself!).  The fix is in CVS now and will go out with 8.3.1.
      
      - eric
      
      -- 04/11/2000 ericm
      
      
      
    4. foundin initialized to: "obsolete: 8.3"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "81. Bundled Packages"
    10. title initialized to:
      ::msgcat::mc only checks the current namespace for resolving
      
    11. type initialized to: "RFE"
  2. Ticket change [2a2dccd002] (rid 118509) by welch on 2000-10-26 08:34:06:

    1. closedate changed to: "2000-10-26T01:34:06"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"
  3. Ticket change [28c0ed9627] (rid 88753) by dgp on 2001-04-05 07:55:31:

    1. foundin changed to: "None"
    2. status changed to: "Open"
    3. subsystem changed to: "None"
  4. Ticket change [567901c0df] (rid 94321) by dgp on 2001-04-05 07:56:45:

    1. closedate changed to: "2001-04-05T00:56:45"
    2. closer changed to: "dgp"
    3. status changed to: "Closed"
    4. subsystem changed to: "30. msgcat Package"