1
amin_ts
Date persian
  • 2015/7/7 6:19

  • amin_ts

  • Just popping in

  • Posts: 70

  • Since: 2005/3/6 1


Hello

when I upgrade my XOOPS from 2.5.6 to 2.5.7.1 then Home page web site show blank page because my local language is persian and Suppert xoops for persian langauge (xoops.ir) didn't publish persian version core xoops for 2.5.7.1 then I upgrade xoops from main version.

when I replaced file locale.php from /language/english/locale.php with file locale.php in language/persian/locale.php , site open normally but date web site changed from persian to english .

please help me for make necessary change in this file locale.php in persian langauge:

language/persian/locale.php:
/*
 You may not change or alter any portion of this comment or credits
 of supporting developers from this source code or any supporting source code 
 which is considered copyrighted (c) material of the original comment or credit authors.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

/**
 * Xoops locale
 *
 * @copyright       The XOOPS project http://sourceforge.net/projects/xoops/
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
 * @package         kernel
 * @since           2.3.0
 * @author          Taiwen Jiang 
 * @version         $Id: locale.php 8066 2011-11-06 05:09:33Z beckmi $
 * @todo            To be handled by i18n/l10n
 */
// defined('XOOPS_ROOT_PATH') or die('Restricted access');

setlocale(LC_ALL,'fa_IR');
// lang file in the persian language directory
include_once dirname(__FILE__) . '/locale.lang.php';
// config file in the persian language directory
include_once dirname(__FILE__) . '/locale.config.php';

//start add file for jalali calendar config and language files
include_once dirname(__FILE__) . '/date/jdf.php';
//end add file for jalali calendar config and language files
class XoopsLocal extends XoopsLocalAbstract
{
// start add jalali calendar for persian language 
    /*
    * Function to display formatted times in user timezone
    */
    
function formatTimestamp($time$format "l"$timeoffset null)
    {
        global 
$xoopsConfig$xoopsUser;

        
$format_copy $format;
        
$format strtolower($format);

        if (
$format == 'rss' || $format == 'r') {
            
$TIME_ZONE '';
            if (isset(
$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;
        }

        if ((
$format == 'elapse' || $format == 'e') && $time time()) {
            
$elapse time() - $time;
            if (
$days floor($elapse / (24 3600))) {
                
$num $days sprintf(_DAYS$days) : _DAY;
            } elseif (
$hours floor(($elapse % (24 3600)) / 3600)) {
                
$num $hours sprintf(_HOURS$hours) : _HOUR;
            } elseif (
$minutes floor(($elapse 3600) / 60)) {
                
$num $minutes sprintf(_MINUTES$minutes) : _MINUTE;
            } else {
                
$seconds $elapse 60;
                
$num $seconds sprintf(_SECONDS$seconds) : _SECOND;
            }
            
$ret sprintf(_ELAPSE$num);
            return 
$ret;
        }
        
// 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 (
$format) {
            case 
's':
                
$datestring _SHORTDATESTRING;
                break;

            case 
'm':
                
$datestring _MEDIUMDATESTRING;
                break;

            case 
'mysql':
                
$datestring 'Y-m-d H:i:s';
                break;

            case 
'l':
                
$datestring _DATESTRING;
                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(000date('m'$current_timestamp), date('d'$current_timestamp), date('Y'$current_timestamp));
                }

                if (
abs($elapse_today $usertimestamp $today_timestamp) < 24 60 60) {
                    
$datestring = ($elapse_today 0) ? _TODAY _YESTERDAY;
                } else {
                    if (!isset(
$monthy_timestamp)) {
                        
$monthy_timestamp[0] = mktime(00000date('Y'$current_timestamp));
                        
$monthy_timestamp[1] = mktime(00000date('Y'$current_timestamp) + 1);
                    }
                    if (
$usertimestamp >= $monthy_timestamp[0] && $usertimestamp $monthy_timestamp[1]) {
                        
$datestring _MONTHDAY;
                    } else {
                        
$datestring _YEARMONTHDAY;
                    }
                }
                break;

            default:
                if (
$format != '') {
                    
$datestring $format_copy;
                } else {
                    
$datestring _DATESTRING;
                }
                break;
        }

    
// Start hacked by irmtfan for show hegira date in persian and other languages www.jadoogaran.org
    
if (_JDF_USE_HEGIRADATE && $format != 'mysql' ){
         return 
jdate($datestring,$usertimestamp);
       } else {
             return 
ucfirst(date($datestring,$usertimestamp));
           }
    
// End hacked by irmtfan for show hegira date in persian and other languages www.jadoogaran.org
    
}
// end add jalali calendar for persian language 
    
function number_format($number)
    {
        switch (
_NUM_TYPE) {
            case 
"figure":
                if (
_JDF_USE_PERSIANNUM){
                    return 
Convertnumber2farsi($number);
                } else {
                    return 
$number;
                }
                break;
            case 
"word":
                return (
$number 0) ? XoopsLocal::num2Words($number) : _NUMWORDS_ZERO;
                break;
            default:
                return 
$number;
                break;
        }    
    }
    function 
num2Words($no)
    {
        global 
$_numWords;
        if(
$no == 0)
            return 
' ';
        else {
            
$novalue='';
            
$highno=$no;
            
$remainno=0;
            
$value=100;
            
$value1=1000;        
            while(
$no>=100)    {
                if((
$value <= $no) &&($no  $value1)) {
                    
$novalue=$_numWords["$value"];
                    
$highno = (int)($no/$value);
                    
$remainno $no $value;
                    break;
                }
                
$value$value1;
                
$value1 $value 1000;
            }
            if(
array_key_exists("$highno",$_numWords)) {
                return 
$_numWords["$highno"]." ".$novalue." ".XoopsLocal::num2Words($remainno);
            } else { 
                
$unit=$highno%10;
                
$ten =(int)($highno/10)*10;             
                return 
$_numWords["$ten"]." ".$_numWords["$unit"]." ".$novalue." ".XoopsLocal::num2Words($remainno);
            }
        }
    }    
    function 
money_format($format$number)
    {
        
setlocale(LC_MONETARY,'fa_IR');
        return 
money_format($format$number);
    }
    
// reserved for future versions
    // Core and module developers can use this syntax in the future versions: XoopsLocal::strtotime($inputtime)
    
function strtotime($inputtime)
    {
        return 
strtotime(inputTimeToGregorian($inputtime));
    }

}
?>



and locale.php in English language is:

/*
 You may not change or alter any portion of this comment or credits
 of supporting developers from this source code or any supporting source code
 which is considered copyrighted (c) material of the original comment or credit authors.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

/**
 * Xoops locale
 *
 * @copyright       The XOOPS project http://sourceforge.net/projects/xoops/
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
 * @package         kernel
 * @since           2.3.0
 * @author          Taiwen Jiang 
 * @version         $Id: locale.php 12537 2014-05-19 14:19:33Z beckmi $
 * @todo            To be handled by i18n/l10n
 */
defined('XOOPS_ROOT_PATH') || die('Restricted access');

setlocale(LC_ALL'en_US');

// !!IMPORTANT!! insert '' before any char among reserved chars: "a","A","B","c","d","D","e","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'
define("_TODAY","Today G:i");
define("_YESTERDAY","Y\es\t\e\rday G:i");
define("_MONTHDAY","n/j G:i");
define("_YEARMONTHDAY","Y/n/j G:i");
define("_ELAPSE","%s ago");
define("_TIMEFORMAT_DESC","Valid formats: "s" - " _SHORTDATESTRING "; "m" - " _MEDIUMDATESTRING "; "l" - " _DATESTRING ";""c" or "custom" - format determined according to interval to present; "e" - Elapsed; "mysql" - Y-m-d H:i:s;"specified string - Refer to http://php.net/manual/en/function.date.php" rel="external">PHP manual.");

/**
 * A Xoops Local
 *
 * @package     kernel
 * @subpackage  Language
 *
 * @author      Taiwen Jiang 
 * @copyright   copyright (c) 2000-2009 XOOPS.org
 */
class XoopsLocal extends XoopsLocalAbstract
{
    
/**
     * Number Formats
     *
     * @param  unknown_type $number
     * @return unknown
     */
    
function number_format($number)
    {
        return 
number_format($number2'.',',');
    }

    
/**
     * Money Format
     *
     * @param  string $format
     * @param  string $number
     * @return money  format
     */
    
function money_format($format$number)
    {
        
setlocale(LC_MONETARY'en_US');

        return 
money_format($format$number);
    }
}

2
Mamba
Re: Date persian
  • 2015/7/18 6:57

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


I am not sure if this will help, but there was a discussion in the past about Persian date format (see this thread)

I've sent an email to Irmtfan (who is from Iran) asking him if he could release XOOPS 2.5.7.1 in Persian, but didn't hear back from him.
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

Login

Who's Online

455 user(s) are online (337 user(s) are browsing Support Forums)


Members: 0


Guests: 455


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits