-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path_lang.php
More file actions
22 lines (19 loc) · 775 Bytes
/
_lang.php
File metadata and controls
22 lines (19 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
// ===== LANGUAGE SELECTOR ================================================================================
$avail_languages = array('en');
if (isset($_GET['hl'])&&in_array(strtolower($_GET['hl']), $avail_languages)) {
$_SESSION['lang'] = strtolower($_GET['hl']);
setcookie('lang', strtolower($_GET['hl']), time()+3600*24*365);
}
elseif (!isset($_SESSION['lang'])) {
if (isset($_COOKIE['lang']) && in_array($_COOKIE['lang'], $avail_languages)) {
$_SESSION['lang'] = $_COOKIE['lang'];
}
else {
$_SESSION['lang'] = $avail_languages[0];
}
}
$loc_content = db_x('SELECT id, str FROM localizable WHERE lang="'.$_SESSION['lang'].'";');
while ($locstr = db_fetch($loc_content)) {
$GLOBALS['localized_strings'][$locstr['id']] = $locstr['str'];
}