Re: gros probleme cbb3.08 | Titre du sujet : Re: gros probleme cbb3.08 par xavhmn sur 10/01/2007 07:22:39
Pour moi ca marche, mais dans le répertoire Frameworks/xoops22/language/french, il ya maintenant trois fichiers:
Local.php
<?php
/**
* Xoops multi-language string and encoding handling class
*
* @copyright The XOOPS project http://www.xoops.org/
* @license http://www.fsf.org/copyleft/gpl.html& ... public license
* @package language
* @version $Id: local.php 108 2006-03-23 17:41:10Z phppp $
* @author D.J. (phppp)
* @since 2.2
*/
// !!IMPORTANT!! insert '' before any char among reserved chars: "a", "A", "B", "c", "d", "D", "F", "g", "G", "h", "H", "i", "I", "j", "l", "L", "m", "M", "n", "O", "r", "s", "S", "t", "T", "U", "w", "W", "Y", "y", "z", "Z"
// insert double '' before 't', 'r', 'n'
if(!defined("_YEARMONTHDAY")) {
define("_TODAY", "Aujou\rd'hui G:i:s");
define("_YESTERDAY", "Hie\r G:i:s");
define("_MONTHDAY", "d/m H:i:s");
define("_YEARMONTHDAY", "d/m/Y H:i");
}
define("_ELAPSE_DAYS", "Il y a %d jour(s)");
define("_ELAPSE_HOURS", "Il y a %d heure(s)");
define("_ELAPSE_MINUTES", "Il y a %d minute(s)");
define("_TIMEFORMAT_DESC", "Formats valides: "s" - "._SHORTDATESTRING."; "m" - "._MEDIUMDATESTRING."; "l" - "._DATESTRING.";<br />".
""c" or "custom" - format determined according to interval to present; "e" - Elapsed; "mysql" - Y-m-d H:i:s;<br />".
"specified string - Refer to <a href="http://php.net/manual/en/function.date.php" target="_blank">PHP manual</a>."
);
require_once dirname(dirname(__FILE__))."/english/local.class.php";
/**
* The class should be an abstract one using PHP embedded functions
* based on which,
* each local language defines its own equalient methods
*
* A comprehensive handler is expected in Xoops 2.3 or 2.4
*/
class XoopsLocal extends XoopsLocalEnglish
{
}
?>
tu as aussi local.class.php
<?php
/**
* Xoops multi-language string and encoding handling class
*
* @copyright The XOOPS project http://www.xoops.org/
* @license http://www.fsf.org/copyleft/gpl.html& ... public license
* @package language
* @version $Id: local.php 108 2006-03-23 17:41:10Z phppp $
* @author D.J. (phppp)
* @since 2.2
*/
/**
* The class should be an abstract one using PHP embedded functions
* based on which,
* each local language defines its own equalient methods
*
* A comprehensive handler is expected in Xoops 2.3 or 2.4
*/
class XoopsLocalEnglish
{
// localized substr
function substr($str, $start, $length, $trimmarker = '...')
{
if ( !XOOPS_USE_MULTIBYTES ) {
return ( strlen($str) - $start <= $length ) ? substr( $str, $start, $length ) : substr( $str, $start, $length - strlen($trimmarker) ) . $trimmarker;
}
if (function_exists('mb_internal_encoding') && @mb_internal_encoding(_CHARSET)) {
$str2 = mb_strcut( $str , $start , $length - strlen( $trimmarker ) );
return $str2 . ( mb_strlen($str)!=mb_strlen($str2) ? $trimmarker : '' );
}
return $str;
}
// Each local language should define its own equalient utf8_encode
function utf8_encode($text)
{
return utf8_encode($text);
}
function convert_encoding($text, $to = 'utf-8', $from = '')
{
if(empty($text)) {
return $text;
}
if(empty($from)) $from = empty($GLOBALS["xlanguage"]['charset_base']) ? _CHARSET : $GLOBALS["xlanguage"]['charset_base'];
if (empty($to) || !strcasecmp($to, $from)) return $text;
if(XOOPS_USE_MULTIBYTES && function_exists('mb_convert_encoding')) $converted_text = @mb_convert_encoding($text, $to, $from);
else
if(function_exists('iconv')) $converted_text = @iconv($from, $to . "//TRANSLIT", $text);
$text = empty($converted_text) ? $text : $converted_text;
return $text;
}
function trim($text)
{
$ret = trim($text);
return $ret;
}
/**
* Get description for setting time format
*/
function getTimeFormatDesc()
{
return _TIMEFORMAT_DESC;
}
/**
* Function to display formatted times in user timezone
*
* Setting $timeoffset to null (by default) will skip timezone calculation for user, using default timezone instead, which is a MUST for cached contents
*/
function formatTimestamp($time, $format = "l", $timeoffset = null)
{
global $xoopsConfig, $xoopsUser;
if(strtolower($format) == "rss" ||strtolower($format) == "r"){
$TIME_ZONE = "";
if(!empty($GLOBALS['xoopsConfig']['server_TZ'])){
$server_TZ = abs(intval($GLOBALS['xoopsConfig']['server_TZ'] * 3600.0));
$prefix = ($GLOBALS['xoopsConfig']['server_TZ'] < 0) ? " -" : " +";
$TIME_ZONE = $prefix.date("Hi", $server_TZ);
}
$date = gmdate("D, d M Y H:i:s", intval($time)) . $TIME_ZONE;
return $date;
}
// disable user timezone calculation and use default timezone,
// for cache consideration
if($timeoffset === null) {
$timeoffset = ($xoopsConfig['default_TZ'] == '') ? '0.0' : $xoopsConfig['default_TZ'];
}
$usertimestamp = xoops_getUserTimestamp($time, $timeoffset);
switch (strtolower($format)) {
case 's':
$datestring = _SHORTDATESTRING;
break;
case 'm':
$datestring = _MEDIUMDATESTRING;
break;
case 'mysql':
$datestring = "Y-m-d H:i:s";
break;
case 'rss':
$datestring = "r";
break;
case 'l':
$datestring = _DATESTRING;
break;
case 'e':
case 'elapse':
static $current_timestamp;
if(!isset($current_timestamp)) {
$current_timestamp = xoops_getUserTimestamp(time(), $timeoffset);
}
$elapse = $current_timestamp - $usertimestamp;
if( $days = floor( $elapse / (24 * 3600) ) ) {
$ret = sprintf(_ELAPSE_DAYS, $days);
}elseif( $hours = floor( ( $elapse % (24 * 3600) ) / 3600 ) ) {
$ret = sprintf(_ELAPSE_HOURS, $hours);
}else {
$minutes = floor( ( $elapse % (24 * 60) ) / 60 );
$ret = sprintf(_ELAPSE_MINUTES, $minutes);
}
return $ret;
break;
case 'c':
case 'custom':
static $current_timestamp, $today_timestamp, $monthy_timestamp;
if(!isset($current_timestamp)) {
$current_timestamp = xoops_getUserTimestamp(time(), $timeoffset);
}
if(!isset($today_timestamp)) {
$today_timestamp = mktime(0, 0, 0, date("m", $current_timestamp), date("d", $current_timestamp), date("Y", $current_timestamp));
}
if($usertimestamp >= $today_timestamp) {
$datestring = _TODAY;
}elseif($usertimestamp >= $today_timestamp - 24*60*60) {
$datestring = _YESTERDAY;
}else {
if(!isset($monthy_timestamp)) {
$monthy_timestamp = mktime(0, 0, 0, 0, 0, date("Y", $current_timestamp));
}
if($usertimestamp >= $monthy_timestamp) {
$datestring = _MONTHDAY;
}else{
$datestring = _YEARMONTHDAY;
}
}
break;
default:
if ($format != '') {
$datestring = $format;
} else {
$datestring = _DATESTRING;
}
break;
}
return ucfirst(date($datestring, $usertimestamp));
}
// adding your new functions
// calling the function:
// Method 1: echo xoops_local("hello", "Some greeting words");
// Method 2: echo XoopsLocal::hello("Some greeting words");
function hello($text)
{
$ret = "<div>Salut, ".$text."</div>";
return $ret;
}
}
?>
et user.php que j'ai pas encore traduit.
Pour que la nouvelle versin fonctionne bien, il faut tout traduire dans le Frameworks. Même avec ca, j'ai encore des problèmes de trad avec la partie transfert qui me le donne en english alors qu'il y à les trads french.De plus le html ne marche pas correctement dans les postes.
|
|