Menu

#3965 (ok 4.0.4) Default language wrong with zh-TW

4.0.3
fixed
None
1
2013-06-17
2013-06-03
benck
No

Default accept-language for Chrome on a traditional Chinese Windows machine is:

Accept-Language:zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4

However, the default language selected by phpMyAdmin is simplified Chinese which is wrong. I think there is something wrong in the file: select_lang.lib.php.

Discussion

  • benck

    benck - 2013-06-05

    I further examined the code in the file select_lang.lib.php. The problem is in PMA_langDetect().

    In this loop

    foreach ($GLOBALS['available_languages'] as $lang => $value)
    

    "zh_CN" is iterated before "zh_TW" in array $GLOBALS['available_languages']. However, the regexp for "zh_CN" does not contain "_CN" so it does match "zh-TW".

    I recommend to make the regexp string for "zh_CN" from

    'zh|chinese simplified'
    

    to

    'zh(?![-_](tw|hk))([-_][[:alpha:]]{2,3})?|chinese simplified'
    

    in function PMA_langDetails().

    The new regexp matches all languages starting with zh but not zh_TW or zh_HK which is correct in real world. Only TW and HK use traditional Chinese while others (CN, SG, MY) use simplified one.

     

    Last edit: benck 2013-06-05
  • Marc Delisle

    Marc Delisle - 2013-06-06
    • assigned_to: Marc Delisle
     
  • Marc Delisle

    Marc Delisle - 2013-06-06

    Thanks, your solution was implemented for 4.0.4.

     
  • Marc Delisle

    Marc Delisle - 2013-06-06
    • summary: Default language wrong with zh-TW --> (ok 4.0.4) Default language wrong with zh-TW
    • status: open --> open-fixed
    • Priority: 5 --> 1
     
  • Michal Čihař

    Michal Čihař - 2013-06-11
    • Status: open-fixed --> resolved
     
  • Marc Delisle

    Marc Delisle - 2013-06-17
    • Status: resolved --> fixed