From 2bcd6f706379bc3c2c104d5ba6d22c106d9c3b8d Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Thu, 1 Oct 2026 21:36:19 +0200 Subject: [PATCH] tdf#144175: Remove strings from l10n in html export + convert datetime to ISO format Result: For the change of lcl_AddStamp, I used GPT 5.6 Luna. Change-Id: Ia73e9c00f17653aa5ab491c4bbc1d3d933105836 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211696 Reviewed-by: Julien Nabet Tested-by: Jenkins --- sc/inc/globstr.hrc | 4 ---- sc/source/filter/html/htmlexp.cxx | 40 +++++++++---------------------- 2 files changed, 11 insertions(+), 33 deletions(-) diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index ab57077239c7..a659141189bf 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -373,10 +373,6 @@ #define STR_LINKERRORFILE NC_("STR_LINKERRORFILE", "File:") #define STR_LINKERRORTAB NC_("STR_LINKERRORTAB", "Sheet:") #define STR_OVERVIEW NC_("STR_OVERVIEW", "Overview") -#define STR_DOC_INFO NC_("STR_DOC_INFO", "Doc.Information") -#define STR_DOC_PRINTED NC_("STR_DOC_PRINTED", "Printed") -#define STR_BY NC_("STR_BY", "by") -#define STR_ON NC_("STR_ON", "on") #define STR_TRUST_DOCUMENT_WARNING NC_("STR_TRUST_DOCUMENT_WARNING", "Are you sure you trust this document?") #define STR_WEBSERVICE_WITH_LINKS_WARNING NC_("STR_WEBSERVICE_WITH_LINKS_WARNING", "Links to remote locations can be constructed that transmit local data to the remote server.") #define STR_REIMPORT_AFTER_LOAD NC_("STR_REIMPORT_AFTER_LOAD", "This file contains queries. The results of these queries were not saved.\nDo you want these queries to be repeated?") diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index 263823f0e3ec..9ee6284ce8ea 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -134,8 +135,6 @@ const char ScHTMLExport::sIndentSource[nIndentMax+1] = #define OUT_SP_CSTR_ASS( s ) rStrm.WriteChar(' ').WriteOString( s ).WriteChar( '=' ) -#define GLOBSTR(id) ScResId( id ) - void ScFormatFilterPluginImpl::ScExportHTML( SvStream& rStrm, const OUString& rBaseURL, ScDocument* pDoc, const ScRange& rRange, const rtl_TextEncoding /*eNach*/, bool bAll, const OUString& rStreamPath, OUString& rNonConvertibleChars, const OUString& rFilterOptions ) @@ -163,33 +162,17 @@ static OString lcl_getColGroupString(sal_Int32 nSpan, sal_Int32 nWidth) return aByteStr.makeStringAndClear(); } -static void lcl_AddStamp( OUString& rStr, std::u16string_view rName, - const css::util::DateTime& rDateTime, - const LocaleDataWrapper& rLoc ) +static void lcl_AddStamp(OUString& rStr, std::u16string_view rName, + const css::util::DateTime& rDateTime) { - Date aD(rDateTime.Day, rDateTime.Month, rDateTime.Year); - tools::Time aT(rDateTime.Hours, rDateTime.Minutes, rDateTime.Seconds, - rDateTime.NanoSeconds); - DateTime aDateTime(aD,aT); - - OUString aStrDate = rLoc.getDate( aDateTime ); - OUString aStrTime = rLoc.getTime( aDateTime ); - - rStr += GLOBSTR( STR_BY ) + " "; + rStr += u"by "_ustr; if (!rName.empty()) rStr += rName; else - rStr += "???"; - rStr += " " + GLOBSTR( STR_ON ) + " "; - if (!aStrDate.isEmpty()) - rStr += aStrDate; - else - rStr += "???"; - rStr += ", "; - if (!aStrTime.isEmpty()) - rStr += aStrTime; - else - rStr += "???"; + rStr += u"???"_ustr; + + rStr += u" on "_ustr; + rStr += utl::toISO8601(rDateTime); } static OString lcl_makeHTMLColorTriplet(const Color& rColor) @@ -336,10 +319,9 @@ void ScHTMLExport::WriteHeader() if (!xDocProps->getPrintedBy().isEmpty()) { - OUT_COMMENT( GLOBSTR( STR_DOC_INFO ) ); - OUString aStrOut = GLOBSTR( STR_DOC_PRINTED ) + ": "; - lcl_AddStamp( aStrOut, xDocProps->getPrintedBy(), - xDocProps->getPrintDate(), ScGlobal::getLocaleData() ); + OUT_COMMENT( u"Doc.Information" ); + OUString aStrOut = u"Printed: "_ustr; + lcl_AddStamp( aStrOut, xDocProps->getPrintedBy(), xDocProps->getPrintDate() ); OUT_COMMENT( aStrOut ); }