summaryrefslogtreecommitdiffstats
path: root/web/lib/translator.inc
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2011-04-07 03:53:31 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2011-04-10 15:40:50 +0200
commit22a718ea89bb78e25532d5256dc212cd0bcba94e (patch)
tree16013085e5bcde79f8dfa06325806febc659f683 /web/lib/translator.inc
parent779ecc8c3a36f3981453ec81f4c84e42a000f23f (diff)
downloadaur-22a718ea89bb78e25532d5256dc212cd0bcba94e.tar.gz
aur-22a718ea89bb78e25532d5256dc212cd0bcba94e.tar.xz
Replace translation engine with php-gettext.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/lib/translator.inc')
-rw-r--r--web/lib/translator.inc16
1 files changed, 6 insertions, 10 deletions
diff --git a/web/lib/translator.inc b/web/lib/translator.inc
index 6bb93588..c4508a9e 100644
--- a/web/lib/translator.inc
+++ b/web/lib/translator.inc
@@ -22,12 +22,14 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib' . PATH_SEPARATOR
# print __("This is a %hmajor%h problem!", "<b>", "</b>");
include_once('config.inc');
+include_once('gettext.php');
+include_once('streams.php');
-global $_t;
+global $streamer, $l10n;
function __() {
- global $_t;
global $LANG;
+ global $l10n;
# Create the translation.
$args = func_get_args();
@@ -35,14 +37,8 @@ function __() {
# First argument is always string to be translated
$tag = $args[0];
- # If there is no translation, just print the given string.
- if (empty($_t[$tag])) {
- $translated = $tag;
- }
- else {
- $translated = $_t[$tag];
- }
-
+ # Translate using gettext_reader initialized before.
+ $translated = $l10n->translate($tag);
$translated = htmlspecialchars($translated, ENT_QUOTES);
$num_args = sizeof($args);