[Libreoffice-commits] core.git: xmloff/source

Eike Rathke erack at redhat.com
Tue Sep 13 20:10:48 UTC 2016


 xmloff/source/style/xmlnumfi.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit ccfbc9d3ac83fa238d6240b5365dc7572c64d241
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 13 22:05:09 2016 +0200

    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

diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 257d945..7d1db52 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


More information about the Libreoffice-commits mailing list