-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
executable file
·32 lines (27 loc) · 1.14 KB
/
index.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
<?php
/**
* Gettext Checker
*
* @author Pierre-Henry Soria <[email protected]>
* @copyright (c) 2016, Pierre-Henry Soria. All Rights Reserved.
*/
// First off, check if Gettext is installed
if (!function_exists('gettext')) {
echo 'You don\'t have Gettext installed on your PHP server.<br /> Please install Gettext first.';
}
define('PH7_LANG_NAME', 'fr_FR');
define('PH7_ENCODING', 'UTF8');
/*** Set locale environment variables for gettext ***/
putenv('LC_ALL=' . PH7_LANG_NAME);
if (!setlocale(LC_ALL, PH7_LANG_NAME)) {
echo '"setlocale()" failed: The given locale (language) "' . PH7_LANG_NAME . '" is not available on your web host/server. Please contact your hosting company to add that locale or check why "setlocale()" PHP function isn\'t working.<br /><br />' . "\r\n";
}
textdomain('global');
bindtextdomain('global', __DIR__ . '/langs');
bind_textdomain_codeset(PH7_LANG_NAME, PH7_ENCODING);
$sRes = gettext('Sign in to Admin Panel');
if ($sRes === 'Sign in to Admin Panel') {
echo "--> Translation Failed: Original Message was returned instead.<br /><br />\r\n";
} else {
echo "--> Translated Message:\r\n" . $sRes;
}