summaryrefslogtreecommitdiffstats
path: root/web/lib/translator.inc
diff options
context:
space:
mode:
authorLoui Chang <louipc.ist@gmail.com>2010-01-09 06:47:39 +0100
committerLoui Chang <louipc.ist@gmail.com>2010-01-09 06:47:39 +0100
commit06e400a2f0b59e41f333458a5e3acf67b0fd3f1c (patch)
tree6969ecca79e1ca4e215c5e45972e3702293c0026 /web/lib/translator.inc
parent8eab9ed4625a0ee657841fd9e894065acdf6e69c (diff)
downloadaur-06e400a2f0b59e41f333458a5e3acf67b0fd3f1c.tar.gz
aur-06e400a2f0b59e41f333458a5e3acf67b0fd3f1c.tar.xz
translator.inc: Remove old and deprecated code.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Diffstat (limited to 'web/lib/translator.inc')
-rw-r--r--web/lib/translator.inc29
1 files changed, 6 insertions, 23 deletions
diff --git a/web/lib/translator.inc b/web/lib/translator.inc
index 6d963f50..650f796f 100644
--- a/web/lib/translator.inc
+++ b/web/lib/translator.inc
@@ -1,8 +1,7 @@
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib' . PATH_SEPARATOR . '../lang');
-# this include file provides support for i18n
-#
+# This file provides support for i18n
# usage:
# use the __() function for returning translated strings of
@@ -20,25 +19,12 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib' . PATH_SEPARATOR
#
# examples:
# print __("%s has %s apples.", "Bill", "5");
-# print __("This is a %h%s%h problem!", "<b>","major","</b>");
-#
-# deprecated usage:
-# print __("%s has %s apples.", array("Bill", "5"));
+# print __("This is a %hmajor%h problem!", "<b>", "</b>");
include_once('config.inc');
global $_t;
-function include_lang($trans) {
- global $LANG;
-
- if ($LANG != DEFAULT_LANG) {
- return include_once("$LANG/$trans");
- }
- else
- return true;
-}
-
function __() {
global $_t;
global $LANG;
@@ -63,16 +49,13 @@ function __() {
$translated = htmlspecialchars($translated, ENT_QUOTES);
- # This condition is to reorganise the arguments in case of
- # deprecated usage. __("string", array("string","string"))
- if (!empty($args[1]) && is_array($args[1])) {
- array_unshift($args[1], $tag);
- $args = $args[1];
- }
-
$num_args = sizeof($args);
# Subsequent arguments are strings to be formatted
+ #
+ # TODO: make this more robust.
+ # '%%' should translate to a literal '%'
+
if ( $num_args > 1 ) {
for ($i = 1; $i < $num_args; $i++) {
$translated = preg_replace("/\%[sh]/", $args[$i], $translated, 1);