ODF load: replace YY/YYYY with E/EE only for secondary calendar

In the context of Gengou calendar with Era a [~gregorian]YYYY
should not be [~gregorian]EE (although it works and displays the
same Gregorian year).

Related to https://gerrit.libreoffice.org/c/core/+/108532

Change-Id: Iaec55c997089cbaea424220d858bffdf20ff3706
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112406
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
This commit is contained in:
Eike Rathke
2021-03-13 00:07:48 +01:00
parent 8f669800d0
commit e6d41f2856

View File

@@ -931,7 +931,8 @@ void SvXMLNumFmtElementContext::endFastElement(sal_Int32 )
// calendar of a locale if it is known to implicitly use E.
bool bImplicitEC = (!sCalendar.isEmpty() &&
rParent.GetLocaleData().doesSecondaryCalendarUseEC( sCalendar));
if (bImplicitEC || (!sCalendar.isEmpty() && rParent.HasEra()))
if (bImplicitEC || (!sCalendar.isEmpty() && rParent.HasEra()
&& sCalendar != rParent.GetLocaleData().getDefaultCalendar()->Name))
{
// If E or EE is the first format keyword, passing
// bImplicitEC=true suppresses the superfluous calendar