summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorAthurg Gooth <athurg@gooth.cn>2010-01-08 17:23:09 -0500
committerLoui Chang <louipc.ist@gmail.com>2010-01-08 17:23:09 -0500
commit8eab9ed4625a0ee657841fd9e894065acdf6e69c (patch)
tree219527b5272fa274e627d97ea67dd142033ec4fd /web
parent55dcf5ce87f6e3e159ef35daac5eae86b624df3f (diff)
downloadaurweb-8eab9ed4625a0ee657841fd9e894065acdf6e69c.tar.xz
Make DEFAULT_LANG mean the default language for displayed messages.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Diffstat (limited to 'web')
-rw-r--r--web/lib/aur.inc2
-rw-r--r--web/lib/config.inc.proto6
-rw-r--r--web/lib/translator.inc16
3 files changed, 13 insertions, 11 deletions
diff --git a/web/lib/aur.inc b/web/lib/aur.inc
index f940192..821288d 100644
--- a/web/lib/aur.inc
+++ b/web/lib/aur.inc
@@ -295,6 +295,8 @@ function set_lang() {
if ($LANG != DEFAULT_LANG ) {
include_once("$LANG.po");
+ } else {
+ include_once(DEFAULT_LANG.".po");
}
return;
diff --git a/web/lib/config.inc.proto b/web/lib/config.inc.proto
index c7a1f3c..349a3ff 100644
--- a/web/lib/config.inc.proto
+++ b/web/lib/config.inc.proto
@@ -1,6 +1,7 @@
<?php
+
# NOTE: modify these variables if your MySQL setup is different
-#
+
define( "AUR_db_host", "localhost:/var/run/mysqld/mysqld.sock" );
define( "AUR_db_name", "AUR" );
define( "AUR_db_user", "aur" );
@@ -16,8 +17,7 @@ define( "USERNAME_MAX_LEN", 16 );
define( "PASSWD_MIN_LEN", 4 );
define( "PASSWD_MAX_LEN", 128 );
-# Language that messages are initially written in.
-# This should never change.
+# Default language for displayed messages in the web interface.
define("DEFAULT_LANG", "en");
# Languages we have translations for
diff --git a/web/lib/translator.inc b/web/lib/translator.inc
index 8c90551..6d963f5 100644
--- a/web/lib/translator.inc
+++ b/web/lib/translator.inc
@@ -49,16 +49,16 @@ function __() {
# First argument is always string to be translated
$tag = $args[0];
- if (empty($LANG) || $LANG == DEFAULT_LANG)
+ if (empty($LANG) || $LANG == DEFAULT_LANG){
$translated = $tag;
+ }
+
+ # If there is no translation, just print the given string.
+ if (empty($_t[$tag])) {
+ $translated = $tag;
+ }
else {
- # If there is no translation, just print the given string.
- if (empty($_t[$tag])) {
- $translated = $tag;
- }
- else {
- $translated = $_t[$tag];
- }
+ $translated = $_t[$tag];
}
$translated = htmlspecialchars($translated, ENT_QUOTES);