You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ca...@apache.org on 2007/11/16 12:42:01 UTC
svn commit: r595631 -
/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java
Author: cagatay
Date: Fri Nov 16 03:41:57 2007
New Revision: 595631
URL: http://svn.apache.org/viewvc?rev=595631&view=rev
Log:
Fixed TOMAHAWK-1147, resolves arabic locale issue, thanks to Ahmed Hashim for the patch
Modified:
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java?rev=595631&r1=595630&r2=595631&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java Fri Nov 16 03:41:57 2007
@@ -324,6 +324,8 @@
facesContext.getExternalContext().getRequestMap().put(JAVASCRIPT_ENCODED, Boolean.TRUE);
}
+
+
public static String getLocalizedLanguageScript(FacesContext facesContext, DateFormatSymbols symbols,
int firstDayOfWeek, UIComponent uiComponent,
@@ -342,6 +344,10 @@
{
weekDays = mapShortWeekdays(symbols);
}
+ else if(realFirstDayOfWeek==-1)
+ {
+ weekDays = mapShortWeekdaysStartingWithSaturday(symbols);
+ }
else
throw new IllegalStateException("Week may only start with sunday or monday.");
@@ -779,6 +785,24 @@
return weekdays;
}
+
+ private static String[] mapShortWeekdaysStartingWithSaturday(DateFormatSymbols symbols)
+ {
+ String[] weekdays = new String[7];
+
+ String[] localeWeekdays = symbols.getShortWeekdays();
+
+ weekdays[0] = localeWeekdays[Calendar.SATURDAY];
+ weekdays[1] = localeWeekdays[Calendar.SUNDAY];
+ weekdays[2] = localeWeekdays[Calendar.MONDAY];
+ weekdays[3] = localeWeekdays[Calendar.TUESDAY];
+ weekdays[4] = localeWeekdays[Calendar.WEDNESDAY];
+ weekdays[5] = localeWeekdays[Calendar.THURSDAY];
+ weekdays[6] = localeWeekdays[Calendar.FRIDAY];
+
+ return weekdays;
+ }
+
private static String[] mapWeekdaysStartingWithSunday(DateFormatSymbols symbols)
{
String[] weekdays = new String[7];