Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: ec5d67e685b0fd1e7472b78a2479f82e12ce58bd
Ticket: 3536888fffffffffffffffffffffffffffffffff
Locale guessing of msgcat fails on (some) Windows 7
User & Date: oehhar on 2012-06-21 12:41:10
Changes

  1. assignee changed to: "dgp"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    I experienced on a german-swiss windows 7 computer, that :
    <session on tcl 8.5.11>
    % package require msgcat
    1.4.4
    % msgcat::mcpreferences
    en_us en {}
    </session>
    
    (the last result should be "de_ch de {}")
    
    The reason for that is, that the language is detected observing the
    registry key:
      [HKEY_CURRENT_USER\Control Panel\International\Locale]
    It contains a numerical Language ID (LCID).
    
    Possible values are in the registry subtree:
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\MIME\Database\Rfc1766]
    
    Extract:
    0409 en_us <- this is set
    0407 de      <- this might be acceptable
    0807 de_ch <- this would be correct
    
    The observed value is "0409" which is en_us.
    The correct value would be "de_ch". Still acceptable is "de".
    
    I found other reports, that this registry key is not reliable using
    windows 7:
    http://social.technet.microsoft.com/Forums/en/w7itproinstall/thread/8597901e-47a8-4457-a8dc-653a260808b3
    
    following the links at the end
    http://blogs.msdn.com/b/michkap/archive/2010/03/19/9980203.aspx
    it is proposed, that:
    - there is a new key (since Vista I think) which contain directly the
    IETF language tag (which is close to the locale):
      [HKEY_CURRENT_USER\Control Panel\International\LocaleName]
    
    In this case, this would help. The contained value "de-CH" is correct.
    
    ----
    
    Anyway, the recommended method is to use the system call:
      GetSystemDefaultLCID()
    and from Vista on:
      GetUserDefaultLocaleName()
    
    ---
    
    Two possible methods to solve the issue:
    
    1) extend msgcat to first look to LocaleName
       This is officially not supported but would solve in this case
       The registry entry "LocaleName" is seen as more reliable, as all modern APIs use this instead of CLID's.
       A patch for this case is attached.
    
    2) extend tcl to return the current system locale by an api
       This requires binary code
    
    
    
    
    
  4. foundin changed to: "obsolete: 8.5.11"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "oehhar"
  10. subsystem changed to: "30. msgcat Package"
  11. title changed to:
    Locale guessing of msgcat fails on (some) Windows 7
    
  12. type changed to: "Bug"