From e9e53eb1ef3190ecbcd2feefa1d7cefe8a6ee870 Mon Sep 17 00:00:00 2001
From: Stefan Csomor <csomor@advancedconcepts.ch>
Date: Sun, 29 Mar 2009 18:13:32 +0000
Subject: [PATCH] adding implementation for OSX

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59918 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/common/intl.cpp | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/src/common/intl.cpp b/src/common/intl.cpp
index 5b9c02b7f4..486cbdf0a4 100644
--- a/src/common/intl.cpp
+++ b/src/common/intl.cpp
@@ -75,6 +75,7 @@
 #if defined(__WXOSX__)
     #include "wx/osx/core/cfref.h"
     #include <CoreFoundation/CFLocale.h>
+    #include <CoreFoundation/CFDateFormatter.h>
     #include "wx/osx/core/cfstring.h"
 #endif
 
@@ -2909,8 +2910,34 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat))
         case wxLOCALE_LONG_DATE_FMT:
         case wxLOCALE_DATE_TIME_FMT:
         case wxLOCALE_TIME_FMT:
-            // TODO
-            return wxString();
+            {
+                CFDateFormatterStyle dateStyle = kCFDateFormatterNoStyle;
+                CFDateFormatterStyle timeStyle = kCFDateFormatterNoStyle;
+                switch (index )
+                {
+                    case wxLOCALE_SHORT_DATE_FMT:
+                        dateStyle = kCFDateFormatterMediumStyle;
+                        break;
+                    case wxLOCALE_LONG_DATE_FMT:
+                        dateStyle = kCFDateFormatterLongStyle;
+                        break;
+                    case wxLOCALE_DATE_TIME_FMT:
+                        dateStyle = kCFDateFormatterMediumStyle;
+                        timeStyle = kCFDateFormatterMediumStyle;
+                        break;
+                    case wxLOCALE_TIME_FMT:
+                        timeStyle = kCFDateFormatterMediumStyle;
+                        break;
+                    default:
+                        wxFAIL_MSG( "unexpected time locale" );
+                        return wxString();
+                }
+                wxCFRef<CFDateFormatterRef> dateFormatter( CFDateFormatterCreate
+                    (NULL, userLocaleRef, dateStyle, timeStyle));
+                wxCFStringRef cfs = wxCFRetain( CFDateFormatterGetFormat(dateFormatter ));
+                return TranslateFromUnicodeFormat(cfs.AsString());
+            }
+            break;
 
         default:
             wxFAIL_MSG( "Unknown locale info" );
-- 
2.47.2