sc/source/ui/view/cellsh.cxx | 5 +++-- sw/inc/strings.hrc | 18 ++++++++++++++++-- sw/source/uibase/uiview/view2.cxx | 13 ++++++++++--- 3 files changed, 29 insertions(+), 7 deletions(-)
New commits: commit 41d588835c359171c8d1a410221d75b9410b0c2d Author: Caolán McNamara <[email protected]> AuthorDate: Fri Nov 16 11:35:28 2018 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Nov 16 14:51:22 2018 +0100 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 <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index 1855a5b12892..13b9e546c579 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -770,9 +770,10 @@ void ScCellShell::GetState(SfxItemSet &rSet) 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 b6e47ca1fabe..5866598a5214 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 d753b849b97b..534beec5cce6 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1335,10 +1335,17 @@ void SwView::StateStatusLine(SfxItemSet &rSet) 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())); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
