title: Check locale language in C
body: <p>I want to check if my system is <code>zh_TW.UTF-8</code> or <code>zh_CN.UTF-8</code>.</p>
  
  <p>Use the following code, I can tell that it is <code>UTF-8</code>.
  But, how can I tell whether it is <code>zh_TW</code> or <code>zh_CN</code>?</p>
  
  <pre><code>#include &lt;langinfo.h&gt;
  #include &lt;locale.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int
  main(int argc, char *argv[])
  {
     //setlocale(LC_CTYPE,"");
     setlocale(LC_ALL,"");
     printf("%s\n",nl_langinfo(CODESET));
     printf("%s\n",nl_langinfo(CRNCYSTR));
     exit(EXIT_SUCCESS);
  }
  </code></pre>