代码之家  ›  专栏  ›  技术社区  ›  Daniel Lopez

如何从shell中检测Mac OS X中的当前区域设置

  •  9
  • Daniel Lopez  · 技术社区  · 16 年前

    http://henrik.nyh.se/2007/10/displaying-utf-8-correctly-in-leopard-terminal

    我正在寻找命令行实用程序或AppleScript代码,使我能够找到这些信息。理想情况下,它们将从10.2开始工作

    到目前为止,我发现的最接近的是

    defaults read -g AppleLocale
    

    从10.3版开始生效

    3 回复  |  直到 11 年前
        1
  •  14
  •   cobbal    16 年前

    locale

    10.4及更高版本

    defaults read .GlobalPreferences AppleLanguages | tr -d [:space:] | cut -c2-3
    

    提到 here

        2
  •  7
  •   vartec    16 年前
    locale 
    

    或者如果没有争议的话

    env | grep LC_
    
        3
  •  0
  •   user246672 user246672    8 年前
    export LANG=$(defaults read -g AppleLanguages | \
      sed '/"/!d;s/["[:space:]]//g;s/-/_/').UTF-8