1 /* Copyright (C) 2011 Edward Der-Hua Liu, Hsin-Chu, Taiwan
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation version 2.1
6  * of the License.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
16  */
17 
18 #include "hime.h"
19 
20 #include "lang.h"
21 
22 gboolean is_chs;
23 char *tsin32_f = "tsin32";
24 
set_is_chs()25 void set_is_chs () {
26     char *lc_ctype = getenv ("LC_CTYPE");
27     char *lc_all = getenv ("LC_ALL");
28     char *lang = getenv ("LANG");
29     if (!lc_ctype && lang)
30         lc_ctype = lang;
31 
32     if (lc_all)
33         lc_ctype = lc_all;
34 
35     if (!lc_ctype)
36         lc_ctype = "zh_TW.Big5";
37     dbg ("hime get env LC_CTYPE=%s  LC_ALL=%s  LANG=%s\n", lc_ctype, lc_all, lang);
38 
39     if (strstr (lc_ctype, "zh_CN") || 0) {
40         is_chs = TRUE;
41     }
42 
43     if (is_chs) {
44         tsin32_f = "s-tsin32";
45         dbg ("is simplified chinese\n");
46     }
47 }
48