summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-11-16 11:35:28 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-11-16 14:51:22 +0100
commit41d588835c359171c8d1a410221d75b9410b0c2d (patch)
tree1ae9473ead8f3fce47d067ba0553b5b22c342a43 /sw
parent890afecb45bfcd2e53599974fbcf61fffd8f8a7b (diff)
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>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/strings.hrc18
-rw-r--r--sw/source/uibase/uiview/view2.cxx13
2 files changed, 26 insertions, 5 deletions
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()));