cvs: pres2 / .htaccess messages.php

From: Date: Tue, 24 May 2005 23:18:42 +0000
Subject: cvs: pres2 / .htaccess messages.php
Groups: php.pres 
Request: Send a blank email to pres+get-1141@lists.php.net to get a copy of this message
jmcastagnetto Tue May 24 19:18:42 2005 EDT Added files: /pres2 messages.php Modified files: /pres2 .htaccess Log: OOPS, forgot this file for the localization patch. http://cvs.php.net/diff.php/pres2/.htaccess?r1=1.1&r2=1.2&ty=u Index: pres2/.htaccess diff -u pres2/.htaccess:1.1 pres2/.htaccess:1.2 --- pres2/.htaccess:1.1 Sun Jul 21 12:23:35 2002 +++ pres2/.htaccess Tue May 24 19:18:41 2005 @@ -1,6 +1,7 @@ Options FollowSymLinks <IfModule mod_rewrite.c> RewriteEngine On -RewriteBase / +RewriteBase /pres2 RewriteRule ^([^\.\?/]+)$ /index.php/$1 [QSA] </IfModule> +php_flag register_globals on http://cvs.php.net/co.php/pres2/messages.php?r=1.1&p=1 Index: pres2/messages.php +++ pres2/messages.php <?php // set locale and bindings if we are using gettext if (PRES2_USE_GETTEXT && extension_loaded('gettext')) { define('PRES2_GETTEXT_INIT', _init_gettext()); } else { define('PRES2_GETTEXT_INIT', false); } // always include the messages file, it is our backup $lang_file = PRES2_LOCALEDIR.'/'.PRES2_LOCALE.'/LC_MESSAGES/pres2.php'; include_once $lang_file; function _init_gettext() { // locale setting can be a pain // TODO need to see if there are missing locale aliases $locales_array = array( 'en' => array('en_US', 'en_GB', 'en_AU', 'en_CA', 'english', 'C'), 'es' => array('es_ES', 'es_PE', 'es_MX', 'es_AR', 'spanish'), ); $loc = setlocale(LC_MESSAGES, $locales_array[PRES2_LOCALE]); if ($loc !== false) { putenv('LC_MESSAGES='.$loc); } $tdom = textdomain('pres2'); $btex = bindtextdomain('pres2', PRES2_LOCALEDIR); return ($loc !== false) && ($btex == realpath(PRES2_LOCALEDIR)) && ($tdom == 'pres2'); } function message($str) { // try using gettext if initiliazed if (PRES2_GETTEXT_INIT) { $trans = gettext($str); if ($trans != $str) { // only return something if gettext worked return $trans; } } // otherwise use the messages array $trans = $GLOBALS['messages'][$str]; return ($trans == '' || is_null($trans)) ? $str : $trans; } ?>

« previous php.pres (#1141) next »