reportdesign/inc/strings.hrc                              |    2 -
 reportdesign/source/ui/inspection/DataProviderHandler.cxx |    2 -
 unotools/source/i18n/resmgr.cxx                           |   23 +++-----------
 3 files changed, 7 insertions(+), 20 deletions(-)

New commits:
commit 249d37a8c4ae113d4043f7bdc1213fbd1a22f3b8
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon Sep 23 10:25:53 2024 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Mon Sep 23 15:39:27 2024 +0200

    reportdesign: Use NC_ to create a TranslateId
    
    I don't see any reason for handling `RID_STR_EXPLANATION`
    differently than all other translatable strings here.
    
    Change-Id: Ica678557124f4daf48c3759fe3640fe95a2bc8ba
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173810
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/reportdesign/inc/strings.hrc b/reportdesign/inc/strings.hrc
index 5d3b8836570c..b1c4392a867a 100644
--- a/reportdesign/inc/strings.hrc
+++ b/reportdesign/inc/strings.hrc
@@ -64,7 +64,7 @@
 #define RID_STR_TYPE                            NC_("RID_STR_TYPE", "Data 
Field Type")
 #define RID_STR_MASTERFIELDS                    NC_("RID_STR_MASTERFIELDS", 
"Link master fields")
 #define RID_STR_DETAILFIELDS                    NC_("RID_STR_DETAILFIELDS", 
"Link slave fields")
-#define RID_STR_EXPLANATION                     ("Charts can be used to 
display detailed data about the current record of the report. To do this, you 
can specify which columns in the chart match which columns in the report.")
+#define RID_STR_EXPLANATION                     NC_("RID_STR_EXPLANATION", 
"Charts can be used to display detailed data about the current record of the 
report. To do this, you can specify which columns in the chart match which 
columns in the report.")
 #define RID_STR_DETAILLABEL                     NC_("RID_STR_DETAILLABEL", 
"Chart")
 #define RID_STR_MASTERLABEL                     NC_("RID_STR_MASTERLABEL", 
"Report")
 #define RID_STR_PREVIEW_COUNT                   NC_("RID_STR_PREVIEW_COUNT", 
"Preview Row(s)")
diff --git a/reportdesign/source/ui/inspection/DataProviderHandler.cxx 
b/reportdesign/source/ui/inspection/DataProviderHandler.cxx
index b8c6a1c15fce..18d4c286339d 100644
--- a/reportdesign/source/ui/inspection/DataProviderHandler.cxx
+++ b/reportdesign/source/ui/inspection/DataProviderHandler.cxx
@@ -470,7 +470,7 @@ bool DataProviderHandler::impl_dialogLinkedFields_nothrow( 
::osl::ClearableMutex
         {"ParentWindow", 
m_xContext->getValueByName(u"DialogParentWindow"_ustr)},
         {"Detail", uno::Any(m_xDataProvider)},
         {"Master", 
uno::Any(m_xReportComponent->getSection()->getReportDefinition())},
-        {"Explanation", uno::Any(RptResId(TranslateId(nullptr, 
RID_STR_EXPLANATION)))},
+        {"Explanation", uno::Any(RptResId(RID_STR_EXPLANATION))},
         {"DetailLabel", uno::Any(RptResId(RID_STR_DETAILLABEL))},
         {"MasterLabel", uno::Any(RptResId(RID_STR_MASTERLABEL))},
     }));
commit d12c622da8934ae7bafed8eeff897e2717d9419b
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon Sep 23 09:50:59 2024 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Mon Sep 23 15:39:20 2024 +0200

    unotools: Use existing OUString::fromUtf8 instead of local helper
    
    `OUString::fromUtf8` already implements the logic
    that the local helper function `createFromUtf8`
    reimplements except that it doesn't allow passing
    a string length other than the length of the passed
    string.
    
    However, all callers pass the string length anyway,
    so use OUString::fromUtf8 and drop the
    local helper function.
    
    Change-Id: I7710e465d1159db0862382df5a954692dbc3cf5c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173808
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index b1573c3f7c14..6d66728f415f 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -70,19 +70,6 @@
 
 namespace
 {
-    OUString createFromUtf8(const char* data, size_t size)
-    {
-        OUString aTarget;
-        bool bSuccess = rtl_convertStringToUString(&aTarget.pData,
-                                                   data,
-                                                   size,
-                                                   RTL_TEXTENCODING_UTF8,
-                                                   
RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR);
-        (void) bSuccess;
-        assert(bSuccess);
-        return aTarget;
-    }
-
     OString genKeyId(const OString& rGenerator)
     {
         sal_uInt32 nCRC = rtl_crc32(0, rGenerator.getStr(), 
rGenerator.getLength());
@@ -216,12 +203,12 @@ namespace Translate
         if (std::use_facet<boost::locale::info>(loc).language() == "qtz")
         {
             OString sKeyId(genKeyId(OString::Concat(sContextAndId.mpContext) + 
"|" + std::string_view(sContextAndId.getId())));
-            return OUString::fromUtf8(sKeyId) + u"\u2016" + 
createFromUtf8(sContextAndId.getId(), strlen(sContextAndId.getId()));
+            return OUString::fromUtf8(sKeyId) + u"\u2016" + 
OUString::fromUtf8(sContextAndId.getId());
         }
 
         //otherwise translate it
         const std::string ret = 
boost::locale::pgettext(sContextAndId.mpContext, sContextAndId.getId(), loc);
-        OUString result(ExpandVariables(createFromUtf8(ret.data(), 
ret.size())));
+        OUString result(ExpandVariables(OUString::fromUtf8(ret.data())));
 
         if (comphelper::LibreOfficeKit::isActive())
         {
@@ -237,7 +224,7 @@ namespace Translate
     {
         std::string lang = std::use_facet<boost::locale::info>(loc).name(); // 
en_US.UTF-8
         lang = lang.substr(0, lang.find('.')); // en_US
-        return createFromUtf8(lang.data(), lang.size());
+        return OUString::fromUtf8(lang.data());
     }
 
     OUString nget(TranslateNId aContextSingularPlural, int n, const 
std::locale &loc)
@@ -247,12 +234,12 @@ namespace Translate
         {
             OString 
sKeyId(genKeyId(OString::Concat(aContextSingularPlural.mpContext) + "|" + 
aContextSingularPlural.mpSingular));
             const char* pForm = n == 0 ? aContextSingularPlural.mpSingular : 
aContextSingularPlural.mpPlural;
-            return OUString::fromUtf8(sKeyId) + u"\u2016" + 
createFromUtf8(pForm, strlen(pForm));
+            return OUString::fromUtf8(sKeyId) + u"\u2016" + 
OUString::fromUtf8(pForm);
         }
 
         //otherwise translate it
         const std::string ret = 
boost::locale::npgettext(aContextSingularPlural.mpContext, 
aContextSingularPlural.mpSingular, aContextSingularPlural.mpPlural, n, loc);
-        OUString result(ExpandVariables(createFromUtf8(ret.data(), 
ret.size())));
+        OUString result(ExpandVariables(OUString::fromUtf8(ret.data())));
 
         if (comphelper::LibreOfficeKit::isActive())
         {

Reply via email to