OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Date/Time Zone

Are you a Director, Presenter, Reviewer or Conference Manager in need of help? Want to talk to us about workflow issues? This is your forum.

Moderators: jmacgreg, michael

Forum rules
This forum is meant for general questions about the usability of OCS from an everyday user's perspective: conference managers, presenters, and directors are welcome to post questions here, as are librarians and other support staff. We welcome general questions about the role of OCS and how the workflow works, as well as specific function- or user-related questions.

What to do if you have general, workflow or usability questions about OCS:

1. Read the documentation. We've written documentation to cover from OCS basics to system administration and code development, and we encourage you to read it.

2. take a look at the tutorials. We will continue to add tutorials covering OCS basics as time goes on.

3. Post a question. Questions are always welcome here, but if it's a technical question you should probably post to the OCS Technical Support subforum; if you have a development question, try the OCS Development subforum.

Date/Time Zone

Postby choobin84 » Mon Sep 01, 2008 11:25 pm

hi,
i need to change the date and its calendar in ocs from international calendar into persian calendar(farsi or jalali).
how do it?
tanx.
choobin84
 
Posts: 9
Joined: Mon Sep 01, 2008 11:16 pm

Re: Date/Time Zone

Postby jmacgreg » Tue Sep 02, 2008 9:27 pm

Hi choobin84,

Changing to Persian may be a little tricky, but try and follow the instructions set out in the following thread: viewtopic.php?f=9&t=2068. PHP's date formatting tools may not be up to Persian dates. Don't worry about the patch discussed in the above thread: it has been included in recent releases.

Cheers,
James
jmacgreg
 
Posts: 4162
Joined: Tue Feb 14, 2006 10:50 am

Re: Date/Time Zone

Postby choobin84 » Tue Sep 02, 2008 11:18 pm

thank you...
but i don't know how this work?
which file must be change?
choobin84
 
Posts: 9
Joined: Mon Sep 01, 2008 11:16 pm

Re: Date/Time Zone

Postby jmacgreg » Wed Sep 03, 2008 3:04 pm

Hi choobin84,

You will want to find the following code block in config.inc.php:

Code: Select all
 Short and long date formats
date_format_trunc = "%m-%d"
date_format_short = "%Y-%m-%d"
date_format_long = "%B %e, %Y"
datetime_format_short = "%Y-%m-%d %I:%M %p"
datetime_format_long = "%B %e, %Y - %I:%M %p"


And change the values (the stuff in quotation marks) for each parameter to locale-specific settings (for example, as listed in http://ca.php.net/manual/en/function.strftime.php,

Code: Select all
- %a - abbreviated weekday name according to the current locale
- %A - full weekday name according to the current locale
- %b - abbreviated month name according to the current locale
- %B - full month name according to the current locale
- %c - preferred date and time representation for the current locale


You will also have to ensure that your default locale is set to Persian in config.inc.php. we can't guarantee that this will work: this is essentially a PHP function, and they may not fully support Persian. Please let us know how you do, and we may be able to provide more assistance.

Cheers,
James
jmacgreg
 
Posts: 4162
Joined: Tue Feb 14, 2006 10:50 am

Re: Date/Time Zone

Postby asmecher » Wed Sep 03, 2008 3:32 pm

Hi choobin84,

We're not especially familiar with using Persian dates -- but we're using standard PHP tools to manage dates, so I did a bit of googling to find whether and how PHP supports them. From pages such as http://bakery.cakephp.org/articles/view/persian-date-helper it appears that PHP does not natively support Persian dates (though I could be wrong). If that's the case, you'll need to do a little bit of PHP work to get Persian dates working. Here is what you'll need to do:
  • Write or find PHP functions to convert from Gregorian to/from Persian; see, for example, http://forums.mpadc.com/showthread.php/hejri-hijri-date-326.html
  • Modify the following classes to use them (instead of the strftime function, which is currently used to format times):
    • classes/submission/reviewer/ReviewerAction.inc.php
    • classes/submission/sectionEditor/SectionEditorAction.inc.php
    • classes/tasks/ReviewReminder.inc.php
  • Modify the Smarty library to support Persian dates; this will involve replacing the date_format and html_select_date functions with versions that support the new format. See, for example, http://phpinsider.com/smarty-forum/viewtopic.php?t=8500.
PHP's existing locale library appears to support localized day and month names, but apparently not different starting years.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 7710
Joined: Wed Aug 10, 2005 12:56 pm

Re: Date/Time Zone

Postby choobin84 » Sat Sep 06, 2008 8:59 pm

asmecher wrote:
    classes/submission/sectionEditor/SectionEditorAction.inc.php


thank you Alec.
but i can not find taht file.
َAre you sure that file is in OCS ?
choobin84
 
Posts: 9
Joined: Mon Sep 01, 2008 11:16 pm

Re: Date/Time Zone

Postby asmecher » Sat Sep 06, 2008 10:58 pm

Hi choobin84,

Oops -- classes/submission/sectionEditor/SectionEditorAction.inc.php is for OJS. The OCS equivalent is classes/submission/trackDirector/TrackDirectorAction.inc.php.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 7710
Joined: Wed Aug 10, 2005 12:56 pm

Re: Date/Time Zone

Postby msaghaei » Tue Sep 09, 2008 1:40 am

Following is a work around to have Jalali calendar in Farsi pages of OJS:

1. Create a jalali folder in classes (lowercase)
2. Place the file Jalali.inc.php in that folder (attached here)
3. in the file TemplateManager.in.php:
Includ 'smarty/plugins/modifier.date_format.php' at the beginning
Code: Select all
require_once('smarty/plugins/modifier.date_format.php');

Add a register_modifier to the list of midifiers
Code: Select all
$this->register_modifier('date_format', array(&$this, 'dateFormat'));

Add the date_format function:
Code: Select all
   /**
    * Override the built-in smarty date_format modifier if tje locale
    * is in array @inArray.
    */
   function dateFormat($date, $format = '%b %e, %Y', $default_date = '', $locale = null, $inArray = array('fa_IR'))    {
       if (!isset($locale)) $locale = Locale::getLocale();
       if (!in_array($locale, $inArray))
           return smarty_modifier_date_format($date, $format, $default_date);
       import('jalali.Jalali');
       $jcal = new Jalali();
       return $jcal->dt_format($date, $format);
   }

4. in the file smarty/plugins/modifier.date_format.php (seems to be a bug):
change the require_once line to
Code: Select all
require_once('shared.make_timestamp.php')


Mahmoud
Attachments
Jalali.inc.php.tar.gz
(10 KiB) Downloaded 210 times
msaghaei
 
Posts: 119
Joined: Sun Jan 08, 2006 1:01 pm

Re: Date/Time Zone

Postby asmecher » Wed Sep 10, 2008 9:17 am

Hi all,

FYI, I've converted Mahmoud's code into a plugin; see http://pkp.sfu.ca/support/forum/viewtopic.php?f=28&t=3538. Thanks for contributing, Mahmoud!

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 7710
Joined: Wed Aug 10, 2005 12:56 pm

Re: Date/Time Zone

Postby choobin84 » Mon Sep 22, 2008 6:29 am

asmecher wrote: http://pkp.sfu.ca/support/forum/viewtopic.php?f=28&t=3538. Thanks for contributing, Mahmoud!


Hi all,
Thanks Alec,
I used that plugin,but no any changes occured.

In TimeLine form that manage the conference timeline ,i want change the september into 'Shahrivar'="شهریور"

I enabled the Jalali plugin.
choobin84
 
Posts: 9
Joined: Mon Sep 01, 2008 11:16 pm

Re: Date/Time Zone

Postby asmecher » Mon Sep 22, 2008 8:41 am

Hi choobin84,

The Jalali plugin only affects the display of dates, not the date select tools. However, if your server supports Farsi dates and you're using the Farsi locale, the Smarty date selector should include translated month names. If you are maintaining your own server, make sure that the fa_IR locale is enabled in /etc/locale.gen. You may need to run locale-gen after uncommenting this line. (Note that these instructions will depend largely on what kind of server you are running.)

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 7710
Joined: Wed Aug 10, 2005 12:56 pm

Re: Date/Time Zone

Postby ramon » Wed Nov 10, 2010 5:25 am

Hello all,
I'm not sure if I should post this here.
I may eventually do the worst thing in forums and cross-post (here) just to reinforce the point.
The point is that date-time configurations should be defined by language.
This means that a single option to define the formats is not enough for a multilingual system.
I believe the simplest way to do this is to create separate config files for languages, loaded when language changes (maybe even created on-the-fly after installation) and a general config file with the basics.
Then, the administrator would have a new option to configure each option for each language.
I think this makes more sense, although not sure how or if it will/should be implemented.
The date-time config may also be implemented as a Pluing, if possible...
ramon
 
Posts: 923
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil


Return to OCS Conference Support and Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron