chiro-canto/public/lang/gettext.php

40 lines
1014 B
PHP

<?php
// print_r($_COOKIE);
$lang = isset($_COOKIE['language']) ? $_COOKIE['language'] : (isset($_SESSION['language']) ? $_SESSION['language'] : "en_US");
$results = putenv('LC_ALL='.$lang);
// echo $lang;
if (!$results) {
echo "putenv failed";
}
// putenv('LANG='.$lang);
$results = setlocale(LC_ALL, $lang);
if (!$results) {
echo "setlocale failed";
}
// Spécifie la localisation des tables de traduction
$results = bindtextdomain('default', "$root/lang/locale");
if (!$results) {
echo "bindtextdomain failed";
}
// Choisit le domaine
$results = textdomain('default');
if (!$results) {
echo "textdomain failed";
}
$results = bind_textdomain_codeset('default', 'UTF-8');
if (!$results) {
echo "bind_textdomain_codeset failed";
}
// // La traduction est cherché dans ./locale/de_DE/LC_MESSAGES/myPHPApp.mo
// // Affichage d'un message de test
// echo gettext("Bienvenue dans mon application PHP");
// // Or use the alias _() for gettext()
// echo _("Passer une bonne journée");
?>