-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathi18n.php
More file actions
33 lines (25 loc) · 758 Bytes
/
i18n.php
File metadata and controls
33 lines (25 loc) · 758 Bytes
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
<?php
// Bind a domain to directory
// Gettext uses domains to know what directories to
// search for translations to messages passed to gettext
@bindtextdomain('default', dirname(__FILE__).'/');
//die(dirname(__FILE__));
// Set the current domain that gettext will use
@textdomain ('default');
$langs = array (
'es' => 'ES',
'en' => 'GB',
'ca' => 'ES',
);
$code = isset($_REQUEST['lang'])?$_REQUEST['lang']:'es';
if (isset($langs[$code]))
$iso_code = $code.'_'.$langs[$code];
else{
$code = "es";
$iso_code = 'es_ES';
}
if (isset($_SESSION['lang'])) $_SESSION['lang']=$code;
// Set the LANGUAGE environment variable to the desired language
putenv ('LANGUAGE='.$iso_code);
putenv ("LC_ALL=$iso_code");
setlocale(LC_ALL, $iso_code);