allow for trailing periods in week day/month names (as used in e.g. French locale)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59998 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-04-03 15:42:06 +00:00
parent ad16130f66
commit 6b26ab96f7

View File

@@ -231,6 +231,21 @@ GetAlphaToken(wxString::const_iterator& p,
return s; 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, // parses string starting at given iterator using the specified format and,
// optionally, a fall back format (and optionally another one... but it stops // optionally, a fall back format (and optionally another one... but it stops
// there, really) // there, really)
@@ -978,7 +993,7 @@ wxDateTime::ParseFormat(const wxString& date,
{ {
wday = GetWeekDayFromName wday = GetWeekDayFromName
( (
GetAlphaToken(input, end), GetNameToken(input, end),
*fmt == 'a' ? Name_Abbr : Name_Full, *fmt == 'a' ? Name_Abbr : Name_Full,
DateLang_Local DateLang_Local
); );
@@ -996,7 +1011,7 @@ wxDateTime::ParseFormat(const wxString& date,
{ {
mon = GetMonthFromName mon = GetMonthFromName
( (
GetAlphaToken(input, end), GetNameToken(input, end),
*fmt == 'b' ? Name_Abbr : Name_Full, *fmt == 'b' ? Name_Abbr : Name_Full,
DateLang_Local DateLang_Local
); );