summaryrefslogtreecommitdiffstats
path: root/web/lib/translator.inc
diff options
context:
space:
mode:
authoreric <eric>2004-06-18 18:23:14 +0200
committereric <eric>2004-06-18 18:23:14 +0200
commit1e35dc01cf94ba1ec4923b8f040e49b4dc399860 (patch)
tree15404a70070fe01c1bcf432fba6befbdb2f2f097 /web/lib/translator.inc
parent79f64a059254bbbae93cf7c2f9dfa512aa5f9f7e (diff)
downloadaur-1e35dc01cf94ba1ec4923b8f040e49b4dc399860.tar.gz
aur-1e35dc01cf94ba1ec4923b8f040e49b4dc399860.tar.xz
finishing touches on genpopo, started playing with _real_ PHP code and svn keywords
Diffstat (limited to 'web/lib/translator.inc')
-rw-r--r--web/lib/translator.inc22
1 files changed, 16 insertions, 6 deletions
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 = "<blink><b>_" . $tag . "_</b></blink>";
}