From bde7be19d65eecf54b3c71435606fd5711728e55 Mon Sep 17 00:00:00 2001 From: quasi Date: Tue, 3 Jan 2012 07:24:19 +0000 Subject: [PATCH] Ausgabe der Datumsfelder im XML um die lokalisierte Ausgabe des Monatsnames erweitert. git-svn-id: https://svn.libreccm.org/ccm/trunk@1417 8810af33-2d31-482b-a856-94f89814c4df --- .../src/com/arsdigita/domain/DomainObjectXMLRenderer.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ccm-core/src/com/arsdigita/domain/DomainObjectXMLRenderer.java b/ccm-core/src/com/arsdigita/domain/DomainObjectXMLRenderer.java index 594b80f21..7b3b90552 100755 --- a/ccm-core/src/com/arsdigita/domain/DomainObjectXMLRenderer.java +++ b/ccm-core/src/com/arsdigita/domain/DomainObjectXMLRenderer.java @@ -27,6 +27,7 @@ import java.util.Calendar; import java.util.Date; import com.arsdigita.xml.XML; import java.text.DateFormat; +import java.text.FieldPosition; import java.util.Stack; import java.util.Map; @@ -338,11 +339,15 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal { Element element = newElement(m_element, name); element.setText((String) format(obj, path, property, value)); - // locale-independent date output + // Quasimodo: + // Special handling of date field, should be done somewhere else + // but that seems to be a problem if (value instanceof Date) { Date date = (Date) value; Calendar calDate = Calendar.getInstance(); calDate.setTime(date); + + // locale-independent date output element.addAttribute("year", Integer.toString(calDate.get(Calendar.YEAR))); element.addAttribute("month", Integer.toString(calDate.get(Calendar.MONTH) + 1)); element.addAttribute("day", Integer.toString(calDate.get(Calendar.DAY_OF_MONTH))); @@ -359,6 +364,7 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal { element.addAttribute("date", dateFormatter.format(date)); element.addAttribute("longDate", longDateFormatter.format(date)); element.addAttribute("time", timeFormatter.format(date)); + element.addAttribute("monthName", calDate.getDisplayName(Calendar.MONTH, Calendar.LONG, negLocale)); // Quasimodo: END }