From ccfbc9d3ac83fa238d6240b5365dc7572c64d241 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Tue, 13 Sep 2016 22:05:09 +0200 Subject: unconditionally replacing Y after G (era) with E was always wrong For example, in en-US locale G MM/DD/YYYY saved and reloaded lead to G MM/DD/EE using the Hebrew calendar. Use E or EE only if a secondary calendar was given. Change-Id: I6db22e89f435342aa4a1bce7fa13711c138007f5 --- xmloff/source/style/xmlnumfi.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'xmloff') diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index 257d945efef1..7d1db52a5eb0 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -1203,11 +1203,13 @@ void SvXMLNumFmtElementContext::EndElement() case XML_TOK_STYLE_YEAR: //! I18N doesn't provide SYSTEM or extended date information yet { - // Y after G (era) is replaced by E, also if we're switching to the - // other second known calendar for a locale. + // Y after G (era) is replaced by E for a secondary calendar. + // Do not replace for default calendar. + // Also replace Y by E if we're switching to the secondary + // calendar of a locale if it is known to implicitly use E. bool bImplicitEC = (!sCalendar.isEmpty() && rParent.GetLocaleData().doesSecondaryCalendarUseEC( sCalendar)); - if (rParent.HasEra() || bImplicitEC) + if (bImplicitEC || (!sCalendar.isEmpty() && rParent.HasEra())) { // If E or EE is the first format keyword, passing // bImplicitEC=true suppresses the superfluous calendar -- cgit