summaryrefslogtreecommitdiffstats
path: root/web/lib/translator.inc
diff options
context:
space:
mode:
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>";
}