Index: sections-app-util/src/java/org/sakaiproject/tool/section/jsf/JsfUtil.java
===================================================================
--- sections-app-util/src/java/org/sakaiproject/tool/section/jsf/JsfUtil.java (revision 97615)
+++ sections-app-util/src/java/org/sakaiproject/tool/section/jsf/JsfUtil.java (working copy)
@@ -34,6 +34,9 @@
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.joda.time.DateTime;
+import org.joda.time.format.DateTimeFormatter;
+import org.joda.time.format.DateTimeFormatterBuilder;
import org.sakaiproject.jsf.util.ConversionUtil;
import org.sakaiproject.tool.section.jsf.MessagingBean;
@@ -188,9 +191,9 @@
// Set the am/pm flag to ensure that the time is parsed properly
if(am) {
- str = str + " AM";
+ str = str + " " + getLocalAMString();
} else {
- str = str + " PM";
+ str = str + " " + getLocalPMString();
}
String pattern = (str.indexOf(':') != -1) ? JsfUtil.TIME_PATTERN_LONG : JsfUtil.TIME_PATTERN_SHORT;
@@ -223,5 +226,29 @@
};
}
+ /**
+ * Get the String representing AM in the users Locale
+ * @return
+ */
+ public static String getLocalAMString() {
+ log.info("getLocalAMString()");
+ //we need an AM date
+ DateTime dt = new DateTime().withTime(1, 0, 0, 0);
+ DateTimeFormatter df = new DateTimeFormatterBuilder().appendHalfdayOfDayText().toFormatter().withLocale(new ResourceLoader().getLocale());
+ return df.print(dt);
+ }
+
+ /**
+ * Get the string representing PM in the users Locale
+ * @return
+ */
+ public static String getLocalPMString() {
+ log.info("getLocalPMString()");
+
+ //we need an PM date
+ DateTime dt = new DateTime().withTime(14, 0, 0, 0);
+ DateTimeFormatter df = new DateTimeFormatterBuilder().appendHalfdayOfDayText().toFormatter().withLocale(new ResourceLoader().getLocale());
+ return df.print(dt);
+ }
}
Index: sections-app-util/pom.xml
===================================================================
--- sections-app-util/pom.xml (revision 97615)
+++ sections-app-util/pom.xml (working copy)
@@ -66,6 +66,11 @@
jsp-api
2.0
+
+ joda-time
+ joda-time
+ 2.0
+