From 659468ebf0197e682cc70629c3b538e793e765a2 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 5 Mar 2007 09:37:13 +0100 Subject: add php-gettext, i18n stuff --- functions.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'functions.php') diff --git a/functions.php b/functions.php index f714abc4a..2e97ddb2c 100644 --- a/functions.php +++ b/functions.php @@ -18,6 +18,9 @@ require_once "magpierss/rss_fetch.inc"; require_once 'magpierss/rss_utils.inc'; + require_once "accept-to-gettext.php"; + require_once "gettext/gettext.inc"; + function purge_feed($link, $feed_id, $purge_interval, $debug = false) { $rows = -1; @@ -3184,4 +3187,17 @@ $msg"; } + function startup_gettext() { + + # Get locale from Accept-Language header + $lang = al2gt(array("en_US", "ru_RU"), "text/html"); + + if ($lang) { + _setlocale(LC_MESSAGES, $lang); + _bindtextdomain("messages", "locale"); + _textdomain("messages"); + _bind_textdomain_codeset("messages", "UTF-8"); + } + } + ?> -- cgit v1.2.3