summaryrefslogtreecommitdiffstats
path: root/web/lib
diff options
context:
space:
mode:
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/aur.inc8
-rw-r--r--web/lib/config.inc.proto11
-rw-r--r--web/lib/translator.inc9
3 files changed, 17 insertions, 11 deletions
diff --git a/web/lib/aur.inc b/web/lib/aur.inc
index 81ffde26..ade5b82c 100644
--- a/web/lib/aur.inc
+++ b/web/lib/aur.inc
@@ -311,12 +311,11 @@ function set_lang() {
$LANG = $row[0];
}
$update_cookie = 1;
- } else {
- $LANG = "en";
}
+ # Set $LANG to default if nothing is valid.
if (!array_key_exists($LANG, $SUPPORTED_LANGS)) {
- $LANG = "en"; # default to English
+ $LANG = DEFAULT_LANG;
}
if ($update_cookie) {
@@ -336,7 +335,7 @@ function html_header($title="") {
global $SUPPORTED_LANGS;
$login = try_login();
- $login_error = $login['error'];
+ $login_error = $login['error'];
$title = htmlspecialchars($title, ENT_QUOTES);
@@ -410,4 +409,3 @@ function uid_from_username($username="")
return $row[0];
}
-?>
diff --git a/web/lib/config.inc.proto b/web/lib/config.inc.proto
index 7a0a155d..505fa7cc 100644
--- a/web/lib/config.inc.proto
+++ b/web/lib/config.inc.proto
@@ -16,9 +16,12 @@ define( "USERNAME_MAX_LEN", 16 );
define( "PASSWD_MIN_LEN", 4 );
define( "PASSWD_MAX_LEN", 128 );
-$LOGIN_TIMEOUT = 7200; # number of idle seconds before timeout
+# Language that messages are initially written in.
+# This should never change.
+define("DEFAULT_LANG", "en");
-$SUPPORTED_LANGS = array( # what languages we have translations for
+# Languages we have translations for
+$SUPPORTED_LANGS = array(
"en" => "English",
"pl" => "Polski",
"it" => "Italiano",
@@ -30,4 +33,6 @@ $SUPPORTED_LANGS = array( # what languages we have translations for
"fr" => "Français"
);
-?>
+# Idle seconds before timeout
+$LOGIN_TIMEOUT = 7200;
+
diff --git a/web/lib/translator.inc b/web/lib/translator.inc
index 41ece89b..f16bd11f 100644
--- a/web/lib/translator.inc
+++ b/web/lib/translator.inc
@@ -37,12 +37,16 @@ function __() {
# First argument is always string to be translated
$tag = $args[0];
- $translated = $_t[$LANG][$tag];
+ if (empty($LANG) || $LANG == DEFAULT_LANG)
+ $translated = $tag;
+ else
+ $translated = $_t[$LANG][$tag];
+
if (empty($translated)) {
# if it's a supported language, but there isn't a translation,
# alert the visitor to the missing translation.
#
- $translated = "<b style=\"color: red\">_${tag}_</b>";
+ $translated = "_${tag}_";
}
# This condition is to reorganise the arguments in case of
@@ -63,4 +67,3 @@ function __() {
return $translated;
}
-?>