From ff730c861b7a8c4e5b7502e198cb1a979ad04abd Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Tue, 11 Oct 2011 21:49:14 +1100 Subject: Started on internationalization (i18n) --- inc/functions.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'inc/functions.php') diff --git a/inc/functions.php b/inc/functions.php index e0163d6f..65a03606 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -5,6 +5,8 @@ exit; } + require 'contrib/gettext/gettext.inc'; + register_shutdown_function('fatal_error_handler'); loadConfig(); @@ -106,6 +108,15 @@ $_SERVER['REMOTE_ADDR'] = $m[2]; } + if(_setlocale(LC_ALL, $config['locale']) === false) { + $error = function_exists('error') ? 'error' : 'basic_error_function_because_the_other_isnt_loaded_yet'; + $error('The specified locale (' . $config['locale'] . ') does not exist on your platform!'); + + } + _bindtextdomain('tinyboard', './inc/locale'); + _bind_textdomain_codeset('tinyboard', 'UTF-8'); + _textdomain('tinyboard'); + if($config['recaptcha']) require_once 'inc/contrib/recaptcha/recaptchalib.php'; if($config['cache']['enabled']) @@ -823,7 +834,7 @@ // Previous button if($num == 0) { // There is no previous page. - $btn['prev'] = 'Previous'; + $btn['prev'] = _('Previous'); } else { $loc = ($mod ? '?/' . $board['uri'] . '/' : '') . ($num == 1 ? @@ -837,12 +848,12 @@ '' . '' :'') . - ''; + ''; } if($num == count($pages) - 1) { // There is no next page. - $btn['next'] = 'Next'; + $btn['next'] = _('Next'); } else { $loc = ($mod ? '?/' . $board['uri'] . '/' : '') . sprintf($config['file_page'], $num + 2); @@ -851,7 +862,7 @@ '' . '' :'') . - ''; + ''; } } } -- cgit v1.3