From ed96566057169e5e95ecf82e18235e66d595fb95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Fri, 5 Oct 2007 18:07:02 +0000 Subject: [PATCH] fix a longstanding issue in AlternC: don't show translation links for which AlternC is not translated this is done by checking if the locales/LANG directory exists, so it's not foolproof, but it's better than simply checking if the locale is configured (which is still done). a bit of code refactoring was done while i'm here --- bureau/class/config.php | 6 +----- bureau/class/lang_env.php | 14 +++++++------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/bureau/class/config.php b/bureau/class/config.php index 02def355..3bbd64f8 100644 --- a/bureau/class/config.php +++ b/bureau/class/config.php @@ -132,11 +132,7 @@ closedir($c); /* Language */ -bindtextdomain("alternc", "/var/alternc/bureau/locales"); - -if (!$do_not_set_lang_env) { - include("lang_env.php"); -} +include_once("lang_env.php"); $mem=new m_mem(); $err=new m_err(); diff --git a/bureau/class/lang_env.php b/bureau/class/lang_env.php index a954e33d..46c22813 100644 --- a/bureau/class/lang_env.php +++ b/bureau/class/lang_env.php @@ -1,28 +1,28 @@ "fr_FR","en_US"=>"en_US"); +$langpath = bindtextdomain("alternc", "/var/alternc/bureau/locales"); + // Create or update a locale.php file if it is outdated. -update_locale(); +$locales = update_locale($langpath); if (!(isset($lang))) { // Use the browser first preferred language $lang=strtolower(substr(trim($_SERVER["HTTP_ACCEPT_LANGUAGE"]),0,5));