留言板

RE: translate calender

sharif razavi,修改在14 年前。

translate calender

Junior Member 帖子: 49 加入日期: 09-8-13 最近的帖子
hi
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
thumbnail
Assaf Yakir,修改在14 年前。

RE: translate calender

New Member 帖子: 17 加入日期: 09-1-30 最近的帖子
Hello Sharif,

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?
thumbnail
Miles Huang,修改在14 年前。

RE: translate calender

Junior Member 帖子: 29 加入日期: 05-8-31 最近的帖子
Hello Assaf,
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.
thumbnail
Corné A,修改在14 年前。

RE: translate calender

Liferay Legend 帖子: 1313 加入日期: 06-10-3 最近的帖子
Yes you may it's is a CLASSPATH thing;
And the CLASSPATH is somewhat depending on your server's classloading policy
and can be manipulated in you startup scripts
sharif razavi,修改在14 年前。

RE: translate calender

Junior Member 帖子: 49 加入日期: 09-8-13 最近的帖子
thx for your very useful response
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
thumbnail
Assaf Yakir,修改在14 年前。

RE: translate calender

New Member 帖子: 17 加入日期: 09-1-30 最近的帖子
Hello Sharif,

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.
sharif razavi,修改在14 年前。

RE: translate calender

Junior Member 帖子: 49 加入日期: 09-8-13 最近的帖子
thx again for ur response
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.
thumbnail
Julio Camarero,修改在14 年前。

RE: translate calender

Liferay Legend 帖子: 1668 加入日期: 08-7-15 最近的帖子
Hi Sharif,

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!
sharif razavi,修改在14 年前。

RE: translate calender

Junior Member 帖子: 49 加入日期: 09-8-13 最近的帖子
hi dear friend i can't find it in jre but i write this program to change the date from latin to shamsi ...but i dont know yet how can i use it for my self i mean how can i use it and where i must use it to change my date system on my portal


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 razavi,修改在14 年前。

RE: translate calender

Junior Member 帖子: 49 加入日期: 09-8-13 最近的帖子
?
thumbnail
Malek Tarboush,修改在13 年前。

RE: translate calender

Junior Member 帖子: 30 加入日期: 10-9-19 最近的帖子
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
thumbnail
Mani kandan,修改在12 年前。

RE: translate calender

Expert 帖子: 492 加入日期: 10-9-15 最近的帖子
Malek Tarboush:
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?
thumbnail
shahrokh hassanzadegan,修改在13 年前。

RE: فارسی سازی تقویم

New Member 帖子: 5 加入日期: 10-5-10 最近的帖子


سلام دوست عزیز

عنوان ترجمه تقویم در واقع بیان درستی برای مشکل شما نیست
شما بایستی از عنوان فارسی سازی یا سفارشی سازی تقویم استفاده کنید

اما برای فارسی سازی شما لازم است یک
taglib
برای نمایش تقویم فارسی داشته باشید
برای مثال می توانید تاریخ روز را با این تگ لیب در
تم قرار دهید

یک سری کلاس برای نوشتن توابعی که بتوانید در جاهای مشخص از آن استفاده کنید
برای مثال ممکن است شما بخواهید یک نمای سفارشی از
assetpublisher
داشته باشید که می توانید
از این توایع که در jar فایلهای
مربوط به
lib
پروژه قرار دارند استفاده کنید
و تاریخ نمایش اخبار را با این روش فارسی کنید

و مسئله سوم در خصوص کامپوننت datepicker
است
که لازم است شما فارسی سازی را در این تگ لیب هم داشته باشید

ما در سایت
www.iranliferay.ir

برای همه این مسائل راه کارهایی داریم
هنوز پک فارسی تولید شده بر روی محصولات قرار ندادیم
اما اگه برای بنده
یک ای میل به آدرس

info@iranliferay.ir
بفرستی این پک و دستورالعمل فارسی سازی را برای شما می فرستم



sharif razavi,修改在12 年前。

RE: فارسی سازی تقویم

Junior Member 帖子: 49 加入日期: 09-8-13 最近的帖子
مرسی که جواب دادید خیلی وقت بود که منتظر چنین چیزی بودم بیخیال شده بودم تقریبا
حتما با ایمیلتون مکاتبه میکنم اگرم دوست داشتید منم یه کارایی تو این زمینه کردم از جمله ترجمه تمامی هلپ لایف ری

عکس
تصاویر
تصاویر
thumbnail
Mani kandan,修改在12 年前。

RE: فارسی سازی تقویم

Expert 帖子: 492 加入日期: 10-9-15 最近的帖子
sharif razavi:
مرسی که جواب دادید خیلی وقت بود که منتظر چنین چیزی بودم بیخیال شده بودم تقریبا
حتما با ایمیلتون مکاتبه میکنم اگرم دوست داشتید منم یه کارایی تو این زمینه کردم از جمله ترجمه تمامی هلپ لایف ری

عکس
تصاویر
تصاویر

Hi sharif,
Can I get this calender widget? Is it possible?
f f,修改在10 年前。

RE: فارسی سازی تقویم

New Member 发布: 1 加入日期: 13-9-12 最近的帖子

سلام
وقت بخیر
می تونم ازتون خواهش کنم ترجمه هلپ لایفری رو در اختیار من بذارید؟
من برای پروژه درسیم به این ترجمه نیاز دارم
البته اگر در زمینه فارسی سازی هم راهنماییم کنید ممنون میشم.
ممنون.

leila azimi,修改在11 年前。

RE: فارسی سازی تقویم

New Member 发布: 1 加入日期: 13-2-23 最近的帖子
shahrokh hassanzadegan:


سلام دوست عزیز

عنوان ترجمه تقویم در واقع بیان درستی برای مشکل شما نیست
شما بایستی از عنوان فارسی سازی یا سفارشی سازی تقویم استفاده کنید

اما برای فارسی سازی شما لازم است یک
taglib
برای نمایش تقویم فارسی داشته باشید
برای مثال می توانید تاریخ روز را با این تگ لیب در
تم قرار دهید

یک سری کلاس برای نوشتن توابعی که بتوانید در جاهای مشخص از آن استفاده کنید
برای مثال ممکن است شما بخواهید یک نمای سفارشی از
assetpublisher
داشته باشید که می توانید
از این توایع که در jar فایلهای
مربوط به
lib
پروژه قرار دارند استفاده کنید
و تاریخ نمایش اخبار را با این روش فارسی کنید

و مسئله سوم در خصوص کامپوننت datepicker
است
که لازم است شما فارسی سازی را در این تگ لیب هم داشته باشید

ما در سایت
www.iranliferay.ir

برای همه این مسائل راه کارهایی داریم
هنوز پک فارسی تولید شده بر روی محصولات قرار ندادیم
اما اگه برای بنده
یک ای میل به آدرس

info@iranliferay.ir
بفرستی این پک و دستورالعمل فارسی سازی را برای شما می فرستم




باسلام
آقاي حسن زادگان من مدتيه روي فارسي سازي تقويم لايفري كار مي كنم اما با اشكالاتي مواجه شدم كه راه حل سرراستي براشون ندارم
اگر ممكنه پك و دستورالعمل فارسي سازي تون رو برام ارسال نماييد
براتون ميل هم زدم ولي ظاهرا ارسال نشده
leila_azm12@yahoo.com
با سپاس

fariba zareie,修改在7 年前。

RE: فارسی سازی تقویم

New Member 帖子: 2 加入日期: 16-1-31 最近的帖子
shahrokh hassanzadegan:


سلام دوست عزیز

عنوان ترجمه تقویم در واقع بیان درستی برای مشکل شما نیست
شما بایستی از عنوان فارسی سازی یا سفارشی سازی تقویم استفاده کنید

اما برای فارسی سازی شما لازم است یک
taglib
برای نمایش تقویم فارسی داشته باشید
برای مثال می توانید تاریخ روز را با این تگ لیب در
تم قرار دهید

یک سری کلاس برای نوشتن توابعی که بتوانید در جاهای مشخص از آن استفاده کنید
برای مثال ممکن است شما بخواهید یک نمای سفارشی از
assetpublisher
داشته باشید که می توانید
از این توایع که در jar فایلهای
مربوط به
lib
پروژه قرار دارند استفاده کنید
و تاریخ نمایش اخبار را با این روش فارسی کنید

و مسئله سوم در خصوص کامپوننت datepicker
است
که لازم است شما فارسی سازی را در این تگ لیب هم داشته باشید

ما در سایت
www.iranliferay.ir

برای همه این مسائل راه کارهایی داریم
هنوز پک فارسی تولید شده بر روی محصولات قرار ندادیم
اما اگه برای بنده
یک ای میل به آدرس

info@iranliferay.ir
بفرستی این پک و دستورالعمل فارسی سازی را برای شما می فرستم






اگه ممکن است یکی از دوستان نحوه ی فارسی سازی تقویم را برای من به این ادرس ایمیل ارسال کند
zareie_fariba@yahoo.com
thumbnail
Hitoshi Ozawa,修改在13 年前。

RE: translate calender

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
There are 2 calendars in Liferay. One to allow users to keep track of events and another one to allow users to select date using a popup.

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
thumbnail
Hitoshi Ozawa,修改在13 年前。

RE: translate calender

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
BTW, you're not trying to "translate" a calendar. You're really trying to "localize" the calendar function in Liferay.
I really have a similar problem in Japanese where year is based on Emperor's year.
Thaer Barhoum,修改在13 年前。

RE: translate calender

New Member 发布: 1 加入日期: 10-9-29 最近的帖子
Hey all
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
thumbnail
Malek Tarboush,修改在13 年前。

RE: translate calender

Junior Member 帖子: 30 加入日期: 10-9-19 最近的帖子
Hello Hitosh
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
thumbnail
Hitoshi Ozawa,修改在13 年前。

RE: translate calender

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
Instead of "replacing" the java time, it may be better to "add" function to the class so we'll later be able to select which time to use depending on the locale.
thumbnail
Hitoshi Ozawa,修改在13 年前。

RE: translate calender

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
Forgot one additional date. Date used in listings such as "Last Post Date" on the wiki page is using persistent date. It's probably better to keep the persistent date in Gregorian, and only change the date on the display.

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.
thumbnail
Malek Tarboush,修改在13 年前。

RE: translate calender

Junior Member 帖子: 30 加入日期: 10-9-19 最近的帖子
Hello Hitoshi
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 OMGemoticon

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
thumbnail
Malek Tarboush,修改在13 年前。

RE: translate calender

Junior Member 帖子: 30 加入日期: 10-9-19 最近的帖子
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?
Alireza Salah,修改在12 年前。

RE: translate calender

New Member 帖子: 3 加入日期: 11-4-11 最近的帖子
Hi

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?
thumbnail
Mani kandan,修改在12 年前。

RE: translate calender

Expert 帖子: 492 加入日期: 10-9-15 最近的帖子
Malek Tarboush:
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 ?
thumbnail
Hitoshi Ozawa,修改在12 年前。

RE: translate calender

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
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
thumbnail
Mani kandan,修改在12 年前。

RE: translate calender

Expert 帖子: 492 加入日期: 10-9-15 最近的帖子
Hitoshi Ozawa:
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?
thumbnail
Mani kandan,修改在12 年前。

RE: translate calender

Expert 帖子: 492 加入日期: 10-9-15 最近的帖子
Still no response?emoticonemoticon