Skip to content

Instantly share code, notes, and snippets.

/.php Secret

Created July 23, 2017 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2a2fccdb72f02fef15847fbc633a24aa to your computer and use it in GitHub Desktop.
Save anonymous/2a2fccdb72f02fef15847fbc633a24aa to your computer and use it in GitHub Desktop.
<?
$locale = 'ru';
$domain = 'mydomain';
$results = putenv("LC_ALL=$locale");
if (!$results) {
exit ('putenv failed');
}
$results = setlocale(LC_ALL, $locale);
if (!$results) {
exit ('setlocale failed: locale function is not available on this platform, or the given local does not exist in this environment');
}
$results = bindtextdomain($domain, "/locale");
echo 'new text domain is set: ' . $results. "\n";
$results = textdomain($domain);
echo 'current message domain is set: ' . $results. "\n";
$results = gettext("This is a text!");
if ($results === "This is a text!") {
echo "original English was returned. Something wrong\n";
}
echo $results . "\n";
die();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment