Related: tdf#83128 translate word/char counts as separate n_gettext args

Change-Id: I2033f4ef51a861c7634dccdae885a842bb079913
Reviewed-on: https://gerrit.libreoffice.org/63465
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 1855a5b..13b9e54 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -770,9 +770,10 @@
                    if( nCol2 != nCol1 || nRow1 != nRow2 )
                    {
                        const auto nRows = nRow2 - nRow1 + 1;
                        OUString aRowArg = ScResId(STR_SELCOUNT_ROWARG, nRows).replaceAll("$1", OUString::number(nRows));
                        const auto nCols = nCol2 - nCol1 + 1;
                        OUString aColArg = ScResId(STR_SELCOUNT_COLARG, nCols).replaceAll("$1", OUString::number(nCols));
                        const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetUILocaleDataWrapper();
                        OUString aRowArg = ScResId(STR_SELCOUNT_ROWARG, nRows).replaceAll("$1", rLocaleData.getNum(nRows, 0));
                        OUString aColArg = ScResId(STR_SELCOUNT_COLARG, nCols).replaceAll("$1", rLocaleData.getNum(nCols, 0));
                        OUString aStr = ScResId(STR_SELCOUNT);
                        aStr = aStr.replaceAll("$1", aRowArg);
                        aStr = aStr.replaceAll("$2", aColArg);
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index b6e47ca..5866598 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -281,8 +281,22 @@
#define STR_DELETE_NOTE_AUTHOR                  NC_("STR_DELETE_NOTE_AUTHOR", "Delete ~All Comments by $1")
#define STR_HIDE_NOTE_AUTHOR                    NC_("STR_HIDE_NOTE_AUTHOR", "H~ide All Comments by $1")
#define STR_OUTLINE_NUMBERING                   NC_("STR_OUTLINE_NUMBERING", "Outline Numbering")
#define STR_STATUSBAR_WORDCOUNT_NO_SELECTION    NC_("STR_STATUSBAR_WORDCOUNT_NO_SELECTION", "%1 words, %2 characters")
#define STR_STATUSBAR_WORDCOUNT                 NC_("STR_STATUSBAR_WORDCOUNT", "%1 words, %2 characters selected")
/* To translators: $1 == will be replaced by STR_WORDCOUNT_WORDARG, and $2 by STR_WORDCOUNT_COLARG
   e.g. Selected: 1 word, 2 characters */
#define STR_WORDCOUNT                           NC_("STR_WORDCOUNT", "Selected: $1, $2")
// To translators: STR_WORDCOUNT_WORDARG is $1 of STR_WORDCOUNT. $1 of STR_WORDCOUNT is number of words
#define STR_WORDCOUNT_WORDARG                   NNC_("STR_WORDCOUNT_WORDARG", "$1 word", "$1 words")
// To translators: STR_WORDCOUNT_CHARARG is $1 of STR_WORDCOUNT. $1 of STR_WORDCOUNT_CHARARG is number of characters
#define STR_WORDCOUNT_CHARARG                   NNC_("STR_WORDCOUNT_CHARARG", "$1 character", "$1 characters")
/* To translators: $1 == will be replaced by STR_WORDCOUNT_WORDARG, and $2 by STR_WORDCOUNT_COLARG
   e.g. 1 word, 2 characters */
#define STR_WORDCOUNT_NO_SELECTION              NC_("STR_WORDCOUNT_NO_SELECTION", "$1, $2")
/* To translators: STR_WORDCOUNT_WORDARG_NO_SELECTION is $1 of STR_WORDCOUNT_NO_SELECTION.
   $1 of STR_WORDCOUNT_NO_SELECTION is number of words */
#define STR_WORDCOUNT_WORDARG_NO_SELECTION      NNC_("STR_WORDCOUNT_WORDARG_NO_SELECTION", "$1 word", "$1 words")
/* To translators: STR_WORDCOUNT_CHARARG_NO_SELECTION is $1 of STR_WORDCOUNT_NO_SELECTION.
   $1 of STR_WORDCOUNT_CHARARG_NO_SELECTION is number of characters */
#define STR_WORDCOUNT_CHARARG_NO_SELECTION      NNC_("STR_WORDCOUNT_CHARARG_NO_SELECTION", "$1 character", "$1 characters")
#define STR_CONVERT_TEXT_TABLE                  NC_("STR_CONVERT_TEXT_TABLE", "Convert Text to Table")
#define STR_ADD_AUTOFORMAT_TITLE                NC_("STR_ADD_AUTOFORMAT_TITLE", "Add AutoFormat")
#define STR_ADD_AUTOFORMAT_LABEL                NC_("STR_ADD_AUTOFORMAT_LABEL", "Name")
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index d753b849..534beec 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1335,10 +1335,17 @@

                sal_uLong nWord = selectionStats.nWord ? selectionStats.nWord : documentStats.nWord;
                sal_uLong nChar = selectionStats.nChar ? selectionStats.nChar : documentStats.nChar;
                OUString aWordCount( SwResId( selectionStats.nWord ? STR_STATUSBAR_WORDCOUNT : STR_STATUSBAR_WORDCOUNT_NO_SELECTION ) );
                const char* pResId = selectionStats.nWord ? STR_WORDCOUNT : STR_WORDCOUNT_NO_SELECTION;
                const char* pWordResId = selectionStats.nWord ? STR_WORDCOUNT_WORDARG : STR_WORDCOUNT_WORDARG_NO_SELECTION;
                const char* pCharResId = selectionStats.nWord ? STR_WORDCOUNT_CHARARG : STR_WORDCOUNT_CHARARG_NO_SELECTION;

                const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetUILocaleDataWrapper();
                aWordCount = aWordCount.replaceFirst( "%1", rLocaleData.getNum( nWord, 0 ) );
                aWordCount = aWordCount.replaceFirst( "%2", rLocaleData.getNum( nChar, 0 ) );
                OUString aWordArg = SwResId(pWordResId, nWord).replaceAll("$1", rLocaleData.getNum(nWord, 0));
                OUString aCharArg = SwResId(pCharResId, nChar).replaceAll("$1", rLocaleData.getNum(nChar, 0));
                OUString aWordCount(SwResId(pResId));
                aWordCount = aWordCount.replaceAll("$1", aWordArg);
                aWordCount = aWordCount.replaceAll("$2", aCharArg);

                rSet.Put( SfxStringItem( FN_STAT_WORDCOUNT, aWordCount ) );

                SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(GetViewFrame()->GetChildWindow(SwWordCountWrapper::GetChildWindowId()));