Handle 5+ letter codes in TranslateFromUnicodeFormat()

Unicode TR #35 v26 allows for five-letter (MMMMM) or even six-letter
(EEEEEE) forms of some of the fields, but TranslateFromUnicodeFormat()
asserts in these situations.

Fix it to fall back to short forms for MMMMM and EEEEEE that are used in
practice e.g. on OS X if the user has custom formatting settings.

Consulting the table of sensible specifiers from
http://userguide.icu-project.org/formatparse/datetime, it appears these
two were the only omissions in this function.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@78424 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2015-01-30 15:53:17 +00:00
parent f047d93c6a
commit 6e35d4bc6b

View File

@@ -1251,6 +1251,8 @@ static wxString TranslateFromUnicodeFormat(const wxString& fmt)
fmtWX += "%A"; fmtWX += "%A";
break; break;
case 5: // EEEEE case 5: // EEEEE
case 6: // EEEEEE
// no "narrow form" in strftime(), use abbrev.
fmtWX += "%a"; fmtWX += "%a";
break; break;
@@ -1276,6 +1278,11 @@ static wxString TranslateFromUnicodeFormat(const wxString& fmt)
fmtWX += "%B"; fmtWX += "%B";
break; break;
case 5:
// no "narrow form" in strftime(), use abbrev.
fmtWX += "%b";
break;
default: default:
wxFAIL_MSG( "too many 'M's" ); wxFAIL_MSG( "too many 'M's" );
} }