-
Notifications
You must be signed in to change notification settings - Fork 10
/
common.php
189 lines (159 loc) · 3.38 KB
/
common.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?php
include('settings1.php');
date_default_timezone_set($TZ);
//translations for HOMEWEATHERSTATION TEMPLATE UPDATED 2nd November added set locale
mb_internal_encoding('UTF-8');
mb_http_output('UTF-8');
mb_http_input('UTF-8');
mb_language('uni');
mb_regex_encoding('UTF-8');
ob_start('mb_output_handler');
if(isSet($_GET['lang']))
{
$lang = $_GET['lang'];
// GET the session set the cookie
$_SESSION['lang'] = $lang;
setcookie("lang", $lang, time() +3600);
}
else if(isSet($_SESSION['lang']))
{
$lang = $_SESSION['lang'];
}
else if(isSet($_COOKIE['lang']))
{
$lang = $_COOKIE['lang'];
}
else
{
$lang = $language;
}
switch ($lang) {
//english uk
case 'en':
$lang_file = 'lang.en.php';
$lang_flag = 'en';
$lang_option = 'en';
setlocale(LC_TIME, "en_EN");
break;
//english canada
case 'can':
$lang_file = 'lang.en.php';
$lang_flag = 'can';
$lang_option = 'en';
setlocale(LC_TIME, "en_EN");
break;
//english us
case 'us':
$lang_file = 'lang.en.php';
$lang_flag = 'us';
$lang_option = 'en';
setlocale(LC_TIME, "en_US");
break;
//danish
case 'dk':
$lang_file = 'lang.dk.php';
$lang_flag = 'dk';
$lang_option = 'en';
setlocale(LC_TIME, 'danish', 'DK', 'da_DK.ISO8859-1', 'da_DK.utf-8');
break;
//dutch
case 'nl':
$lang_file = 'lang.nl.php';
$lang_flag = 'nl';
$lang_option = 'en';
setlocale(LC_TIME, "nl_NL.UTF-8");
break;
//brazilian/south america
case 'br':
$lang_file = 'lang.br.php';
$lang_flag = 'br';
$lang_option = 'en';
setlocale(LC_TIME, "pt_BR.UTF-8");
break;
//argentine
case 'ar':
$lang_file = 'lang.ar.php';
$lang_flag = 'ar';
$lang_option = 'en';
setlocale(LC_TIME, "es_ES.UTF-8");
break;
//polish
case 'pl':
$lang_file = 'lang.pl.php';
$lang_flag = 'pl';
$lang_option = 'en';
setlocale(LC_TIME, 'pl_PL', 'pl_PL.ISO8859-2', 'polish_pol');
break;
//german
case 'dl':
$lang_file = 'lang.dl.php';
$lang_flag = 'dl';
$lang_option = 'en';
setlocale(LC_TIME, "de_DE.UTF-8");
break;
//italian
case 'it':
$lang_file = 'lang.it.php';
$lang_flag = 'it';
$lang_option = 'en';
setlocale(LC_TIME, "it_IT.UTF-8");
break;
//spanish
case 'sp':
$lang_file = 'lang.sp.php';
$lang_flag = 'sp';
$lang_option = 'en';
setlocale(LC_TIME, "es_ES.UTF-8");
break;
//catalan
case 'cat':
$lang_file = 'lang.cat.php';
$lang_flag = 'cat';
$lang_option = 'en';
setlocale(LC_TIME, "ca_ES");
break;
//french
case 'fr':
$lang_file = 'lang.fr.php';
$lang_flag = 'fr';
$lang_option = 'en';
setlocale(LC_TIME, "fr_FR.UTF-8");
break;
//greek
case 'gr':
$lang_file = 'lang.gr.php';
$lang_flag = 'gr';
$lang_option = 'en';
setlocale(LC_TIME, "el_GR.UTF-8");
break;
//turkish
case 'tr':
$lang_file = 'lang.tr.php';
$lang_flag = 'tr';
$lang_option = 'en';
setlocale(LC_TIME, "tr_TR.UTF-8");
break;
//hungarian
case 'hu':
$lang_file = 'lang.hu.php';
$lang_flag = 'hu';
$lang_option = 'en';
setlocale(LC_TIME, "tr_HU.UTF-8");
break;
//Norwegian
case 'no':
$lang_file = 'lang.no.php';
$lang_flag = 'no';
$lang_option = 'en';
setlocale(LC_TIME, "no_NO.UTF-8");
break;
//default
default:
$lang_file = 'lang.'.$defaultlanguage.'.php';
$lang_flag = $defaultlanguage;
$lang_option = 'en';
setlocale(LC_TIME, "");
}
//path to language files
include_once 'languages/'.$lang_file;
?>