<?php
/****************************************************************************************
 * SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV
 *
 * Version 1.0.2
 *
 * Copyright (C) 2006-2015  Sylvain FATOME
 * This program is free software; you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free Software Foundation;
 * either version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program
 * (in the directory docs);
 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 *
 * Contact : galawa@free.fr
 *
 * Web : http://smi.no-ip.org
 ****************************************************************************************/

// Constantes
$locale = (isset($_GET['lang'])) ? $_GET['lang'] : LNG_DEFAULT;
$encoding = 'UTF-8';
$domain = 'trad';

// On vérifie si l'extension gettext est chargée
if (!extension_loaded('gettext')) {
    // Non
    // gettext setup
    T_setlocale(LC_MESSAGES, $locale);
    // Set the text domain as 'messages'
    bindtextdomain($domain, $root . REP . '/lng');
} else {
    // Oui
    putenv("LC_ALL=$locale"); // Pour Windows
    putenv("LANGUAGE=$locale"); // Pour Windows
    // putenv("LANG=" . $language);
    setlocale(LC_ALL, $locale);

    bindtextdomain($domain, $root . REP . '/lng');
}
// bind_textdomain_codeset is supported only in PHP 4.2.0+
if (function_exists('bind_textdomain_codeset'))
    bind_textdomain_codeset($domain, $encoding);
textdomain($domain);
