From 15b02359cdeb7772caf19ce5c2ca403d270b5b0b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 21 Aug 2006 01:44:03 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=10950 --- _autosetup | 6 +- checkin_notes | 14 +++++ doc/poll_results.php | 2 +- doc/prefs_override.php | 13 +++- html/inc/translation.inc | 130 ++++++++++++++++++++++----------------- 5 files changed, 103 insertions(+), 62 deletions(-) diff --git a/_autosetup b/_autosetup index bed4811100..c252ac1248 100755 --- a/_autosetup +++ b/_autosetup @@ -22,7 +22,7 @@ check_version() cd /tmp foundit= ## get current version of $1 - desired=$2 + desired=`echo $2 | awk -F. '{print $1*100+$2}'` echo $ECHO_N "Checking version of '$1' >= $desired... $ECHO_C" name=$1 fullpath=`type $name | awk '{ print $(NF) }'`; @@ -42,7 +42,7 @@ check_version() version="0"; fi if [ -n "${version}" ]; then - version=`echo $version | awk '{ for (i=1;i<=NF;i++) { split($i,j,"."); m=j[1]"."j[2] ; if ((m*1)>0) { print m ; break; } } }'` + version=`echo $version | awk '{ for (i=1;i<=NF;i++) { split($i,j,"."); m=j[1]*100+j[2] ; if ((m*1)>0) { print m ; break; } } }'` if [ -z "$version" ]; then version=0; fi success=`echo "$version" "$desired" | awk '{ if ($1 >= $2) { print "yes";} else {print "no";}} '` else @@ -122,7 +122,7 @@ echo "$cmdline" if eval $cmdline; then echo "Done, now run ./configure" echo " ./configure -C to enable caching" - echo " ./configure --enable-maintainer-mode to enable maintainer depedencies" + echo " ./configure --enable-maintainer-mode to enable maintainer dependencies" exit 0 else echo "Something failed .... please check error-message and re-run when fixed." diff --git a/checkin_notes b/checkin_notes index bd4cad845f..6e2544b4b8 100755 --- a/checkin_notes +++ b/checkin_notes @@ -9015,3 +9015,17 @@ Charlie 19 Aug 2006 api/ mac_icon.C + +David 20 Aug 2006 + - _autosetup: the check_version function doesn't + correctly handle version strings that begins with 0, + such as the pkg-config version 0.15. + This is due to that checking if a value is a number + it is assumed that the number is more than 0. + check_version also assumes that 1.10 is lower than 1.9 since it does a + string comparison. + (from Egon Larsson) + + _autosetup + html/inc/ + translation.inc diff --git a/doc/poll_results.php b/doc/poll_results.php index 74c3b75fde..e3a4481eab 100644 --- a/doc/poll_results.php +++ b/doc/poll_results.php @@ -3,7 +3,7 @@ require_once('docutil.php'); require_once('../html/inc/translation.inc'); -$cachefile = "poll_results_cache_$language.html"; +$cachefile = "cache/poll_results_$language_in_use.html"; if (file_exists($cachefile)) { $age = time() - filemtime($cachefile); diff --git a/doc/prefs_override.php b/doc/prefs_override.php index d16161fdf1..052c665f43 100644 --- a/doc/prefs_override.php +++ b/doc/prefs_override.php @@ -20,18 +20,27 @@ The preferences override file is named global_prefs_override.xml. Its structure as follows: ".html_text(" + 0 0 - 3 - 60 + 0 + 0 + 0 + 0 + 0 + 0 + 0 0.1 2 + 60 60 100 50 0.1 75 + 3 0 0 + 100 ")." diff --git a/html/inc/translation.inc b/html/inc/translation.inc index 917fdec47f..e52ff035fe 100644 --- a/html/inc/translation.inc +++ b/html/inc/translation.inc @@ -382,68 +382,86 @@ if (languagesNeedsRebuild($lang_language_dir, $lang_translations_dir, $lang_prj_ buildLanguages($lang_language_dir,$lang_translations_dir,$lang_prj_translations_dir, $lang_compiled_dir); } -// Define some variables (from constants) that the language files can use in the translation: +// Define some variables (from constants) that the language files +// can use in the translation: + $PROJECT = PROJECT; -if (file_exists($lang_language_dir.$lang_compiled_dir."language_interface.inc")){ - require_once($lang_language_dir.$lang_compiled_dir."language_interface.inc"); - - // Make a list of languages which the user prefers - // (by looking at cookies and browser settings) - // cookies have highest priority. - - if (isset($_COOKIE['lang'])){ - $language_string = $_COOKIE['lang'].","; - } else { - $language_string = ''; - } - if (isset($HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"])) { - $language_string .= strtolower($HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"]); - } - - // Find out which language to use by iterating trough list - // The list is commaseperated, so split it into an array of the following type: - // Array ( - // [0] => da - // [1] => en-us;q=0.7 - // [2] => en;q=0.3 - // ) - - $client_languages=explode(",",$language_string); - - //Now a language is either defined as primary-secondary or merely primary - //it can also have a quality attribute set - which orders the languages in a user - //preffered ordering. Since this is usally the same order as the array indices - //we just ignore this attribute. (TODO: don't ignore this attribute) - //A missing quality attribute means q=1 - - require_once($lang_language_dir.$lang_compiled_dir.$lang_project_default.".po.inc"); - //Always include the project default as fallback - for ($i=sizeof($client_languages)-1;$i>=0;$i--){ - //Now for each language that the client requests - if ((strlen($client_languages[$i])>2) && (substr($client_languages[$i],2,1)=="_" || substr($client_languages[$i],2,1)=="-")){ - //If this is defined as primary-secondary - $language = substr( - $client_languages[$i],0,2)."_".strtoupper(substr($client_languages[$i],3,2) - ); - //represent it as xx_YY - } else { - $language = substr($client_languages[$i],0,2); - //else just use xx - } - if (file_exists($lang_language_dir.$lang_compiled_dir.$language.".po.inc")) { - //If we have the language, include it - //echo "[$language]"; - require($lang_language_dir.$lang_compiled_dir.$language.".po.inc"); - } - } - -} else { +if (!file_exists($lang_language_dir.$lang_compiled_dir."language_interface.inc")){ language_log("Could not load language interface.",2); - echo "ERROR: Could not load language interface. This is a fatal error, exiting."; + echo "ERROR: Could not load language interface. + This is a fatal error, exiting. + "; flush; exit; } +require_once($lang_language_dir.$lang_compiled_dir."language_interface.inc"); + +// Make a list of languages which the user prefers +// (by looking at cookies and browser settings) +// cookies have highest priority. + +if (isset($_COOKIE['lang'])){ + $language_string = $_COOKIE['lang'].","; +} else { + $language_string = ''; +} +if (isset($HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"])) { + $language_string .= strtolower($HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"]); +} + +// Find out which language to use by iterating trough list +// The list is commaseperated, so split it into an array of the following type: +// Array ( +// [0] => da +// [1] => en-us;q=0.7 +// [2] => en;q=0.3 +// ) + +$client_languages=explode(",",$language_string); + +// A language is either defined as primary-secondary or merely primary. +// It can also have a quality attribute set, +// which orders the languages in a user preferred ordering. +// Since this is usally the same order as the array indices +// we just ignore this attribute (TODO: don't ignore this attribute) +// A missing quality attribute means q=1 + +// Always include the project default as fallback +// +require_once( + $lang_language_dir.$lang_compiled_dir.$lang_project_default.".po.inc" +); +$language_in_use = $lang_project_default; + +// loop over languages that the client requests +// +for ($i=sizeof($client_languages)-1;$i>=0;$i--) { + if ((strlen($client_languages[$i])>2) + && (substr($client_languages[$i],2,1)=="_" || substr($client_languages[$i],2,1)=="-")) + { + // If this is defined as primary-secondary, represent it as xx_YY + // + $language = substr( + $client_languages[$i],0,2)."_".strtoupper(substr($client_languages[$i],3,2) + ); + } else { + // else just use xx + // + $language = substr($client_languages[$i],0,2); + } + // If we have a translation for the language, include it + // + if (file_exists($lang_language_dir.$lang_compiled_dir.$language.".po.inc")) { + require($lang_language_dir.$lang_compiled_dir.$language.".po.inc"); + $language_in_use = $language; + + } +} + +// If you include this file, $language_in_use is now set +// to the language actually being used + ?>