allow for trailing periods in week day/month names (as used in e.g. French locale)
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 3 Apr 2009 15:42:06 +0000 (15:42 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 3 Apr 2009 15:42:06 +0000 (15:42 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59998 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/datetimefmt.cpp

index 9f81e2d83c07a62a3b6ba3ccd0a01a8b7b2b754a..a6e9c59d4edde950e2ddbe39e82dcbf3f0de8994 100644 (file)
@@ -231,6 +231,21 @@ GetAlphaToken(wxString::const_iterator& p,
     return s;
 }
 
+// scans all characters which can appear in a week day/month name
+//
+// this is different from GetAlphaToken() as some locales (e.g. fr_FR) use
+// trailing periods after the abbreviated week day/month names
+wxString
+GetNameToken(wxString::const_iterator& p,
+             const wxString::const_iterator& end)
+{
+    wxString token = GetAlphaToken(p, end);
+    if ( p != end && *p == '.' )
+        token += *p++;
+
+    return token;
+}
+
 // parses string starting at given iterator using the specified format and,
 // optionally, a fall back format (and optionally another one... but it stops
 // there, really)
@@ -978,7 +993,7 @@ wxDateTime::ParseFormat(const wxString& date,
                 {
                     wday = GetWeekDayFromName
                            (
-                            GetAlphaToken(input, end),
+                            GetNameToken(input, end),
                             *fmt == 'a' ? Name_Abbr : Name_Full,
                             DateLang_Local
                            );
@@ -996,7 +1011,7 @@ wxDateTime::ParseFormat(const wxString& date,
                 {
                     mon = GetMonthFromName
                           (
-                            GetAlphaToken(input, end),
+                            GetNameToken(input, end),
                             *fmt == 'b' ? Name_Abbr : Name_Full,
                             DateLang_Local
                           );