From f54c326e600e5de79b110fe2522b8d970b68b6ba Mon Sep 17 00:00:00 2001 From: chriskl Date: Mon, 1 Aug 2005 05:54:22 +0000 Subject: [PATCH] Add 'auto' language option. Do not detect language unless it is set to 'auto'. --- HISTORY | 3 +++ conf/config.inc.php-dist | 9 +++++---- conf/slony.inc.php | 11 ----------- libraries/lib.inc.php | 11 +++++------ 4 files changed, 13 insertions(+), 21 deletions(-) delete mode 100755 conf/slony.inc.php diff --git a/HISTORY b/HISTORY index 5a606049..19a7b9e6 100644 --- a/HISTORY +++ b/HISTORY @@ -28,6 +28,9 @@ Features to avoid executing selects that have write side effects. * Allow re-using username and password for all servers - saves re-entering username and password for every server in a pool. +* Make default language 'auto' indicating auto detect. If a language is + deliberately specifed, then that will always be used and no detection will + occur. Bugs * Tree Icons are displayed middle instead of top diff --git a/conf/config.inc.php-dist b/conf/config.inc.php-dist index db7418e1..3ef8ab99 100644 --- a/conf/config.inc.php-dist +++ b/conf/config.inc.php-dist @@ -4,7 +4,7 @@ * Central phpPgAdmin configuration. As a user you may modify the * settings here for your particular configuration. * - * $Id: config.inc.php-dist,v 1.42 2005/06/22 14:21:09 chriskl Exp $ + * $Id: config.inc.php-dist,v 1.43 2005/08/01 05:54:22 chriskl Exp $ */ // An example server. Create as many of these as you wish, @@ -40,9 +40,10 @@ //$conf['servers'][1]['pg_dumpall_path'] = 'C:\\Program Files\\PostgreSQL\\8.0\\bin\\pg_dumpall.exe'; //$conf['servers'][1]['slony_support'] = false; - // Default language for the login screen if there's no translation - // matching user's browser request. Eg: 'english', 'polish', etc. - $conf['default_lang'] = 'english'; + // Default language. Eg: 'english', 'polish', etc. See lang/ directory + // for all possibilities. If you specify 'auto' (the default) it will use + // your browser preference. + $conf['default_lang'] = 'auto'; // If extra login security is true, then logins via phpPgAdmin with no // password or certain usernames (pgsql, postgres, root, administrator) diff --git a/conf/slony.inc.php b/conf/slony.inc.php deleted file mode 100755 index 5094074a..00000000 --- a/conf/slony.inc.php +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/libraries/lib.inc.php b/libraries/lib.inc.php index 899edc87..8e864f51 100644 --- a/libraries/lib.inc.php +++ b/libraries/lib.inc.php @@ -3,7 +3,7 @@ /** * Function library read in upon startup * - * $Id: lib.inc.php,v 1.101 2005/07/31 09:15:07 chriskl Exp $ + * $Id: lib.inc.php,v 1.102 2005/08/01 05:54:31 chriskl Exp $ */ include_once('decorator.inc.php'); include_once('./lang/translations.php'); @@ -94,7 +94,6 @@ } // Determine language file to import: - // 1. Check for the language from a request var if (isset($_REQUEST['language'])) { $_language = strtolower($_REQUEST['language']); @@ -108,7 +107,7 @@ } // 3. Check for acceptable languages in HTTP_ACCEPT_LANGUAGE var - if (!isset($_language) && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { + if (!isset($_language) && $conf['default_lang'] == 'auto' && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { // extract acceptable language tags // (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4) preg_match_all('/\s*([a-z]{1,8}(?:-[a-z]{1,8})*)(?:;q=([01](?:.[0-9]{0,3})?))?\s*(?:,|$)/', strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']), $_m, PREG_SET_ORDER); @@ -128,12 +127,12 @@ unset($_acceptLang); } } - + // 4. Otherwise resort to the default set in the config file - if (!isset($_language) && isset($appLangFiles[$conf['default_lang']])) { + if (!isset($_language) && $conf['default_lang'] != 'auto' && isset($appLangFiles[$conf['default_lang']])) { $_language = $conf['default_lang']; } - + // Import the language file if (isset($_language)) { include("./lang/recoded/{$_language}.php"); -- 2.39.5