diff options
author | Loui Chang <louipc.ist@gmail.com> | 2008-07-09 20:38:08 +0200 |
---|---|---|
committer | Loui Chang <louipc.ist@gmail.com> | 2008-07-22 19:47:17 +0200 |
commit | 1a1a6eb36e17315f08eee0e44a83fe4bdf0887f5 (patch) | |
tree | 1c07e49af06b98ec2b12d0f35a114570be3d9a59 /web/lib/translator.inc | |
parent | 1deb924674d1a42fc9b127a18bdc012c84ec6f93 (diff) | |
download | aur-1a1a6eb36e17315f08eee0e44a83fe4bdf0887f5.tar.gz aur-1a1a6eb36e17315f08eee0e44a83fe4bdf0887f5.tar.xz |
Add a new DEFAULT_LANG constant.
DEFAULT_LANG will essentially be used to specify what language
strings are initially written in.
This will eliminate the need for English translation arrays in
AUR and make adding or changing the English strings a lot easier.
DEFAULT_LANG may be required for strings to display properly.
Also change the output when a translation isn't found.
Eliminate the <b> which can cause validation errors depending
on where the string is placed.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Diffstat (limited to 'web/lib/translator.inc')
-rw-r--r-- | web/lib/translator.inc | 9 |
1 files changed, 6 insertions, 3 deletions
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; } -?> |