<?php // gettext stuff -- will translate into French if asked for $domain = "hitme"; // define "domain" to select *.mo file name bind_textdomain_codeset($domain, 'UTF-8'); bindtextdomain($domain,"./translations"); // where to find the .mo files // Set the current domain that gettext will use textdomain($domain); // Caution! "locale" must exist when you do: locale -a // on the server (and "fr" doesn't on Osiris) $locale="en_CA"; if (isset($_GET["lang"]) && $_GET["lang"]=="fr") $locale="fr_CA"; // now we set for French putenv('LANG='.$locale); //putenv('LC_ALL='.$locale); putenv('LC_MESSAGES='.$locale); setlocale(LC_ALL,$locale); //setlocale(LC_CTYPE,$locale); // doesn't appear necessary ?> <!DOCTYPE HTML> <HTML> <body> <h2><?php echo gettext("Hold your horses"); ?>!</h2> <?php echo _("BOO, HISS, Get lost!"); // _ is alias for gettext