From 407229e16c8d19da6da41ab6a42bb6d3b019e325 Mon Sep 17 00:00:00 2001 From: Gabor Hojtsy Date: Thu, 2 Jan 2003 21:52:31 +0000 Subject: [PATCH] Adding initial support for user level preferred language. Now it is the site's default language. Honor that setting in displaying the documentation table pages by highlighting manuals in that language specially. --- docs.php | 11 +++++++++++ download-docs.php | 9 ++++++++- include/site.inc | 7 +++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/docs.php b/docs.php index c9a49c0a0..3366d7eb6 100644 --- a/docs.php +++ b/docs.php @@ -84,6 +84,10 @@ teams are open to contributions though. // List all manual languages viewable online foreach ($man_languages as $langnum => $langcode) { + + // Make preferred language bold + if ($langcode == preferred_language()) { echo ""; } + echo '' . $LANGUAGES[$langcode] . ''; echo ($lastlang != $langnum) ? ", " : ""; @@ -91,6 +95,9 @@ foreach ($man_languages as $langnum => $langcode) { if ($langcode == "fr") { echo '[Special French], '; } + + if ($langcode == preferred_language()) { echo ""; } + } ?> @@ -100,8 +107,10 @@ foreach ($man_languages as $langnum => $langcode) { // List printer friendly pages of all manual languages foreach ($man_languages as $langnum => $langcode) { + if ($langcode == preferred_language()) { echo ""; } echo '' . $LANGUAGES[$langcode] . ''; echo ($lastlang != $langnum) ? ", " : ""; + if ($langcode == preferred_language()) { echo ""; } } ?> @@ -111,8 +120,10 @@ foreach ($man_languages as $langnum => $langcode) { // List printer friendly pages with notes of all manual languages foreach ($man_languages as $langnum => $langcode) { + if ($langcode == preferred_language()) { echo ""; } echo '' . $LANGUAGES[$langcode] . ''; echo ($lastlang != $langnum) ? ", " : ""; + if ($langcode == preferred_language()) { echo ""; } } ?> diff --git a/download-docs.php b/download-docs.php index 5fcd9b628..017be96de 100644 --- a/download-docs.php +++ b/download-docs.php @@ -127,12 +127,19 @@ foreach ($LANGUAGES as $langcode => $language) { $language .= '
[Special French]'; } + // Highlight manual in preferred language + if ($langcode == preferred_language()) { + $bgcolor = "#ffffcc"; + } else { + $bgcolor = "#eeeeee"; + } + echo "\n$language\n"; // Print out a table cell for all formats foreach ($files as $fileinfo) { - echo ""; + echo ""; // Missing format if ($fileinfo == '') { diff --git a/include/site.inc b/include/site.inc index 739f91509..710e23447 100644 --- a/include/site.inc +++ b/include/site.inc @@ -36,6 +36,13 @@ function default_language($site = FALSE) return $MIRRORS[$site][6]; } +// Returns the preferred language, +// honoring user settings [for future usage] +function preferred_language() +{ + return default_language(); +} + // Returns true if the current (or specified) mirror // site is registered to have local search support function have_search($site = FALSE)