From 1e35dc01cf94ba1ec4923b8f040e49b4dc399860 Mon Sep 17 00:00:00 2001 From: eric Date: Fri, 18 Jun 2004 16:23:14 +0000 Subject: finishing touches on genpopo, started playing with _real_ PHP code and svn keywords --- web/lib/aur.inc | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ web/lib/translator.inc | 22 ++++++++++++++------ 2 files changed, 70 insertions(+), 6 deletions(-) create mode 100644 web/lib/aur.inc (limited to 'web/lib') diff --git a/web/lib/aur.inc b/web/lib/aur.inc new file mode 100644 index 00000000..c45e1dd2 --- /dev/null +++ b/web/lib/aur.inc @@ -0,0 +1,54 @@ +\n"; + print "\n"; + print "AUR\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print "
AUR: An "; + print "ArchLinux project
\n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print "
"; + print ""; + print "ArchLinux User-community Repository
\n"; + print "
\n"; + print "\n\n"; + + return; +} + +# common footer +# +function html_footer($ver="") { + print "\n\n"; + print "

\n"; + if ($ver) { + print "\n"; + print "\n"; + print "
"; + print "".$ver."\n"; + print "
\n"; + } + print "\n"; + return; +} + +# vim: ts=2 sw=2 noet ft=php +?> diff --git a/web/lib/translator.inc b/web/lib/translator.inc index 2d45f2ab..79eb39c7 100644 --- a/web/lib/translator.inc +++ b/web/lib/translator.inc @@ -24,20 +24,30 @@ include_once("common_po.inc"); function _($tag, $args=array()) { global $_t; + global $_REQUEST; global $LANG; - # default to English if the lang hasn't been provided + $supported_langs = array( + "en" => 1, # English + "es" => 1, # Español + "de" => 1, # Deutsch + "fr" => 1, # Français + ); + + # default to English if the lang hasn't been provided or isn't supported # - if (!$LANG) { - $lang = "en"; - } else { - $lang = $LANG; + $LANG = $_REQUEST['LANG']; + if (!$LANG || !array_key_exists($LANG, $supported_langs)) { + $LANG = "en"; } # create the translation, if it doesn't exist, highlight it # - $translated = $_t[$lang][$tag]; + $translated = $_t[$LANG][$tag]; if (!$translated) { + # if it's a supported language, but there isn't a translation, + # alert the visitor to the missing translation. + # $translated = "_" . $tag . "_"; } -- cgit v1.2.3-24-g4f1b