add some base work for KaiRo bug 396 - adding L10n to the auth system
[authserver.git] / app / authsystem.inc.php
index 6e30200293422d7fa3dd9fd5c26d6c7669649b1c..372c4db9c19b9c51afd220828a3ff9df4e5175dc 100644 (file)
@@ -26,14 +26,18 @@ require_once('../kairo-utils/email.php-class');
 // Class for sending emails
 require_once(__DIR__.'/authutils.php-class');
 
-bindtextdomain('kairo_auth', 'en'); // XXX: Should negotiate locale.
-bind_textdomain_codeset('kairo_auth', 'utf-8');
-
 // Connect to our MySQL DB
 $db = new PDO($dbdata['dsn'], $dbdata['username'], $dbdata['password']);
 // Instantiate auth utils.
 $utils = new AuthUtils($settings, $db);
 
+$textdomain = 'kairo_auth';
+$textlocale = $utils->negotiateLocale(array('en', 'de'));
+putenv('LC_ALL='.$textlocale);
+bindtextdomain($textdomain, '../locale');
+bind_textdomain_codeset($textdomain, 'utf-8');
+textdomain($textdomain);
+
 /* Creating the DB tables:
 CREATE TABLE `auth_sessions` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT ,