留言板
RE: translate calender
i want change the type of date in calender and in all of my system from latin calender to shamsi calender how can i do it..and if i want to edit my language on system i must change which files.
thx
razavi
To set a certain language as default throughout the system, set the appropriate properties in the file: ../root/web-inf/classes/system-ext.properties (if the file doesn't exist, simply create it in this location)
#
# Set the default locale used by Liferay. This locale is no longer set at
# the VM level. See LEP-2584.
#
user.country=US
user.language=en
#
# Set the default time zone used by Liferay. This time zone is no longer set
# at the VM level. See LEP-2584.
#
user.timezone=UTC
About the calendar, are you talking about the calendar portlet or the ui calendar/date picker?
Can I put system-ext.properties at ${liferay.home}/system-ext.properties? This is just like what
portal-ext.properties do. Put the customized configuration out of the webapp directory will do great help on the maintenance of the production environment.
Regards,
Miles.
And the CLASSPATH is somewhat depending on your server's classloading policy
and can be manipulated in you startup scripts
actually i want change all date on my system from Latin to shamsi date there is especial algorithm to change it. i think perhaps the portlet will change(may be i'm in mistake)when all time and date in all over the system change... i want just convert the date system in all over system from latin date to shamsi date..
thx alot
First of all, I am definitely not a java expert, and my Liferay experience is not very long, so if I'm wrong I'd love to be corrected.
As far as I know, you can change the time zone systematically, and localize some aspects of the calendar, but not to define the calendar system. At least not out-of-the-box.
Check DateUtil.java & CalendarUtil.java - the Gregorian (Latin) calendar is the only one defined and used throughout the code.
import java.text.DateFormat;
import java.text.Format;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.TimeZone;
.
.
.
Calendar startCal = new GregorianCalendar(timeZone);
I've yet to find any liferay properties/settings regarding a non-Gregorian calendar, but again I might be wrong.
It can be implemented of course. The less preferable but easier way would be to change it all to Shamsi, wich might work for you if you're not going to use the Gregorian calendar at all. However, the optimal way would be to create such a property that defines the calendar and lets you use different calendar systems, such as Shamsi, Hijri, Hebrew etc.
What you should do is add a feature request, but I doubt it gets prioritized in the near future.
it's very useful...but i must change which file? to do this...
in fact i wondered if i know that liferay team didn't augury this problem and i hope they help us to improve this
if i get new information i share it with you.
As Assaf says, I don't think Liferay supports the shamsi calendar out of the box. However, we would be very happy to support it.
Do you know if this calendar is included in Sun JRE?
Thanks a lot!
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
/**
* This class contains some static methods for converting gregorian dates to
* persian date
* @author sharif razavi (sharif.razavi@gmail.com)
*/
public class PersianCal{
private static double len = 365.24219879;
private static double base = 2346;
private static double greg_len = 365.2425;
private static double greg_origin_from_jalali_base = 629964;
private static String greg_month_names[]={"","Jan","Feb","Mar","Apr","May","June","Jul","A ug","Sep","Oct","Nov","Dec"};
//-------------------------------------------------------------------
/** Converts specified gregorian date to persian date in form of (yyyy/mm/dd) */
public static String getPersianDate(int gregYear,int gregMonth,int gregDay){
// passed days from Greg orig
double d = Math.ceil((gregYear-1)*greg_len);
// passed days from jalali base
double d_j = d + greg_origin_from_jalali_base + getGregDayOfYear(gregYear,gregMonth,gregDay);
//first result! jalali year
double j_y = Math.ceil(d_j/len)-2346;
// day of the year
double j_days_of_year = Math.floor(((d_j/len) - Math.floor(d_j/len))*365)+1;
System.out.println(j_days_of_year);
StringBuffer result = new StringBuffer();
result.append((int)j_y+"/"+(int)month(j_days_of_year)+"/"+(int)dayOfMonth(j_days_of_year));
return result.toString();
}
/** Converts specified gregorian date to persian date in form of (yyyy/mm/dd) */
public static String getPersianDate(Date d){
GregorianCalendar gc = new GregorianCalendar();
gc.setTime(d);
int year = gc.get(Calendar.YEAR);
return getPersianDate(year,(gc.get(Calendar.MONTH))+1,gc. get(Calendar.DAY_OF_MONTH));
}
/** Returns persian year according to specified gregorian date. */
public static int getPersianYear(Date dt){
GregorianCalendar gc = new GregorianCalendar();
gc.setTime(dt);
int gregYear = gc.get(Calendar.YEAR);
int gregMonth = gc.get(Calendar.MONTH)+1;
int gregDay = gc.get(Calendar.DAY_OF_MONTH);
double d = Math.ceil((gregYear-1)*greg_len);
double d_j = d + greg_origin_from_jalali_base + getGregDayOfYear(gregYear,gregMonth,gregDay);
double j_y = Math.ceil(d_j/len)-2346;
double j_days_of_year = Math.floor(((d_j/len) - Math.floor(d_j/len))*365);
return (int)j_y;
}
/** returns the persian month number according to specified gregorian date (Months:1..12) */
public static int getPersianMonth(Date dt){
GregorianCalendar gc = new GregorianCalendar();
gc.setTime(dt);
int gregYear = gc.get(Calendar.YEAR);
int gregMonth = gc.get(Calendar.MONTH)+1;
int gregDay = gc.get(Calendar.DAY_OF_MONTH);
double d = Math.ceil((gregYear-1)*greg_len);
double d_j = d + greg_origin_from_jalali_base + getGregDayOfYear(gregYear,gregMonth,gregDay);
double j_y = Math.ceil(d_j/len)-2346;
double j_days_of_year = Math.floor(((d_j/len) - Math.floor(d_j/len))*365);
return (int)month(j_days_of_year);
}
/** Returns day number (1..31) */
public static int getPersianDayOfMonth(Date dt){
GregorianCalendar gc = new GregorianCalendar();
gc.setTime(dt);
int gregYear = gc.get(Calendar.YEAR);
int gregMonth = gc.get(Calendar.MONTH)+1;
int gregDay = gc.get(Calendar.DAY_OF_MONTH);
double d = Math.ceil((gregYear-1)*greg_len);
double d_j = d + greg_origin_from_jalali_base + getGregDayOfYear(gregYear,gregMonth,gregDay);
double j_y = Math.ceil(d_j/len)-2346;
double j_days_of_year = Math.floor(((d_j/len) - Math.floor(d_j/len))*365);
return (int)dayOfMonth(j_days_of_year);
}
//******************************
private static double month(double day){
if(day<=6*31)
return Math.ceil(day/31);
else
return Math.ceil((day-6*31)/30)+6;
}
private static double dayOfMonth(double day){
double m = month(day);
if(m<=6)
return day - 31*(m-1);
else
return day-(6*31)-(m-7)*30;
}
private static double getGregDayOfYear(double year,double month,double day){
int greg_moneths_len[] = {0,31,28,31, 30,31,30, 31,31,30 ,31,30,31};
boolean leap=false;
if(((year%4)==0)&&(((year%400)!=0)))leap = true;
if(leap)greg_moneths_len[2]=29;
int sum=0;
for(int i=0;i<month;i++)
sum+=greg_moneths_len;
return sum+day-2;
}
//**********
sharif did you find anything about how to change the whole system calendar?
we are facing this problem we want to change the calendar to
the islamic calendar ( Hijri calendar )
is there anyway to change it?
is there any way to open such an issue for the liferay team ?
thanks
hello
sharif did you find anything about how to change the whole system calendar?
we are facing this problem we want to change the calendar to
the islamic calendar ( Hijri calendar )
is there anyway to change it?
is there any way to open such an issue for the liferay team ?
thanks
I want to include Hijri calendar(Islamic calendar) in Liferay. Can you pls tel how to include it?
سلام دوست عزیز
عنوان ترجمه تقویم در واقع بیان درستی برای مشکل شما نیست
شما بایستی از عنوان فارسی سازی یا سفارشی سازی تقویم استفاده کنید
اما برای فارسی سازی شما لازم است یک
taglib
برای نمایش تقویم فارسی داشته باشید
برای مثال می توانید تاریخ روز را با این تگ لیب در
تم قرار دهید
یک سری کلاس برای نوشتن توابعی که بتوانید در جاهای مشخص از آن استفاده کنید
برای مثال ممکن است شما بخواهید یک نمای سفارشی از
assetpublisher
داشته باشید که می توانید
از این توایع که در jar فایلهای
مربوط به
lib
پروژه قرار دارند استفاده کنید
و تاریخ نمایش اخبار را با این روش فارسی کنید
و مسئله سوم در خصوص کامپوننت datepicker
است
که لازم است شما فارسی سازی را در این تگ لیب هم داشته باشید
ما در سایت
www.iranliferay.ir
برای همه این مسائل راه کارهایی داریم
هنوز پک فارسی تولید شده بر روی محصولات قرار ندادیم
اما اگه برای بنده
یک ای میل به آدرس
info@iranliferay.ir
بفرستی این پک و دستورالعمل فارسی سازی را برای شما می فرستم
سلام دوست عزیز
عنوان ترجمه تقویم در واقع بیان درستی برای مشکل شما نیست
شما بایستی از عنوان فارسی سازی یا سفارشی سازی تقویم استفاده کنید
اما برای فارسی سازی شما لازم است یک
taglib
برای نمایش تقویم فارسی داشته باشید
برای مثال می توانید تاریخ روز را با این تگ لیب در
تم قرار دهید
یک سری کلاس برای نوشتن توابعی که بتوانید در جاهای مشخص از آن استفاده کنید
برای مثال ممکن است شما بخواهید یک نمای سفارشی از
assetpublisher
داشته باشید که می توانید
از این توایع که در jar فایلهای
مربوط به
lib
پروژه قرار دارند استفاده کنید
و تاریخ نمایش اخبار را با این روش فارسی کنید
و مسئله سوم در خصوص کامپوننت datepicker
است
که لازم است شما فارسی سازی را در این تگ لیب هم داشته باشید
ما در سایت
www.iranliferay.ir
برای همه این مسائل راه کارهایی داریم
هنوز پک فارسی تولید شده بر روی محصولات قرار ندادیم
اما اگه برای بنده
یک ای میل به آدرس
info@iranliferay.ir
بفرستی این پک و دستورالعمل فارسی سازی را برای شما می فرستم
باسلام
آقاي حسن زادگان من مدتيه روي فارسي سازي تقويم لايفري كار مي كنم اما با اشكالاتي مواجه شدم كه راه حل سرراستي براشون ندارم
اگر ممكنه پك و دستورالعمل فارسي سازي تون رو برام ارسال نماييد
براتون ميل هم زدم ولي ظاهرا ارسال نشده
leila_azm12@yahoo.com
با سپاس
سلام دوست عزیز
عنوان ترجمه تقویم در واقع بیان درستی برای مشکل شما نیست
شما بایستی از عنوان فارسی سازی یا سفارشی سازی تقویم استفاده کنید
اما برای فارسی سازی شما لازم است یک
taglib
برای نمایش تقویم فارسی داشته باشید
برای مثال می توانید تاریخ روز را با این تگ لیب در
تم قرار دهید
یک سری کلاس برای نوشتن توابعی که بتوانید در جاهای مشخص از آن استفاده کنید
برای مثال ممکن است شما بخواهید یک نمای سفارشی از
assetpublisher
داشته باشید که می توانید
از این توایع که در jar فایلهای
مربوط به
lib
پروژه قرار دارند استفاده کنید
و تاریخ نمایش اخبار را با این روش فارسی کنید
و مسئله سوم در خصوص کامپوننت datepicker
است
که لازم است شما فارسی سازی را در این تگ لیب هم داشته باشید
ما در سایت
www.iranliferay.ir
برای همه این مسائل راه کارهایی داریم
هنوز پک فارسی تولید شده بر روی محصولات قرار ندادیم
اما اگه برای بنده
یک ای میل به آدرس
info@iranliferay.ir
بفرستی این پک و دستورالعمل فارسی سازی را برای شما می فرستم
اگه ممکن است یکی از دوستان نحوه ی فارسی سازی تقویم را برای من به این ادرس ایمیل ارسال کند
zareie_fariba@yahoo.com
The one for the event tracking is in webapps\ROOT\html\taglib\ui\calendar
As you can see from the code, it's using the CalendarFactoryUtil factory.
The source code for this is in the following Liferay's source code:
\portal-service\src\com\liferay\portal\kernel\util\CalendarUtil.java
I think this is where you want to make your changes.
The one for the popup is in aui library -
1. \webapps\ROOT\html\js\aui\aui-calendar.
Edit the aui-calendar-base.js and compact it to aui-calendar-base-min.js
2. webapps\ROOT\html\js\aui\datatype
Edit the datatype-date.js and compact it to datatype-date-min.js
I really have a similar problem in Japanese where year is based on Emperor's year.
Thank u for this subject
I'm working on calendar But I faced the problem of translation of the calendar
I want to use the other kind of calendar like : // Herbew and Islamic //
But i couldn't do that with localization
SO Do you have the solution for this problem and how did you solve it <<<< Hitoshi >>
Thanks
you are right as you said we are trying to localizing the liferay calendar
i found a good library for converting time
from/to Islamic Hijri ,Gregorian,GregorianJulian etc..
Joda-Time
it can be used as a replacement for the java time and date
i will try to manipulate the classes you mentioned about
and i will put the result here
thanks
Regards
For wiki listing: \ROOT\html\portlet\wiki\view_nodes.jsp
Line #79: convert the node.getLastPostDate()
Liferay also uses SHORT date format. If you require 4 digit year like I do, modify the Java file below:
com.liferay.portal.util.FastDateFormatFactoryImpl
Change the SHORT to MEDIUM on date formats.
I edited the files you mentioned here its ok until now
i edited the functions that calculate the month days
i added a js file that calculate the convert the dates called CCalendar.js
i put it in : /webapps/ROOT/html/js/aui/aui-calendar/
The files i edited are:
JS Files
/webapps/ROOT/html/js/aui/aui-calendar/aui-calendar.js
/webapps/ROOT/html/js/aui/aui-calendar/aui-calendar-base.js
/webapps/ROOT/html/js/aui/aui-calendar/aui-calendar-base-min.js
Java Files
com.liferay.portal.kernel.util.CalendarFactoryUtil
com.liferay.portal.kernel.util.CalendarUtil
com.liferay.portal.util.FastDateFormatFactoryImpl
JSP Fiels
/webapps/ROOT/html/portlet/calendar/year.jspf
/webapps/ROOT/html/portlet/calendar/summary.jspf
/webapps/ROOT/html/portlet/calendar/month.jspf
/webapps/ROOT/html/taglib/ui/calendar/page.jsp
and you mentioned to edit the file
/webapps/ROOT/html/js/aui/datatype/datatype-date.js
but i couldn't find anything to edit !!!
now the problem is that these changes are not applied for the portlets
like Blog , Message Board , etc....
do i have to change it in every portlets?
i guess so OMG
If you have any new idea just post it
i will try to edit the portlet i need
Thanks a lot for help it was very useful
everything is ok i edited the whole calendar portlet
but the only problem is this damn component DatePicker (aui-datepicker-select)
i could not change the month days
for example in the gregorian months there is 30 & 31 & (28 OR 29)
but in Hijri calendar there is no 31 just 30 & 29
i edited a lot of files but it didn't change i don't know why
anyone has any idea ?
or is there anyone from the Liferay staff?
I need your help, I want to change my calender to persian calender but I don't know which file I should edit, and how?
Hello again
everything is ok i edited the whole calendar portlet
but the only problem is this damn component DatePicker (aui-datepicker-select)
i could not change the month days
for example in the gregorian months there is 30 & 31 & (28 OR 29)
but in Hijri calendar there is no 31 just 30 & 29
i edited a lot of files but it didn't change i don't know why
anyone has any idea ?
or is there anyone from the Liferay staff?
Can you please tell me how to bring Hijri calendar in liferay ?
http://www.liferay.com/community/wiki/-/wiki/Main/%E3%82%AB%E3%83%AC%E3%83%B3%E3%83%80%E3%83%BC
Popup (notification portlet: bottom image)
http://www.liferay.com/community/wiki/-/wiki/Main/%E3%81%8A%E7%9F%A5%E3%82%89%E3%81%9B
Samples of how localized calendar should look like.
http://www.liferay.com/community/wiki/-/wiki/Main/%E3%82%AB%E3%83%AC%E3%83%B3%E3%83%80%E3%83%BC
Popup (notification portlet: bottom image)
http://www.liferay.com/community/wiki/-/wiki/Main/%E3%81%8A%E7%9F%A5%E3%82%89%E3%81%9B
Can you pls tell me how to customize the calendar portlet to other Language?