diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-05 15:48:01 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-09 09:52:33 +0200 |
commit | 283229f5bc27ce23456b9cbd9aff75ff44707105 (patch) | |
tree | ecadd85a8937555c8404290ac19c0af6baf4f266 /sc | |
parent | cc6d591e1c4202afdbc30a76fd56d66b7547fa34 (diff) |
Related: tdf#83128 support translation of plural forms
Change-Id: Id3d41099a895ca5423be2ac3d497851bc65eaff7
Reviewed-on: https://gerrit.libreoffice.org/61426
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/scresid.hxx | 1 | ||||
-rw-r--r-- | sc/inc/strings.hrc | 3 | ||||
-rw-r--r-- | sc/source/ui/app/scdll.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/dialogs/searchresults.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/inc/searchresults.hxx | 1 |
5 files changed, 10 insertions, 4 deletions
diff --git a/sc/inc/scresid.hxx b/sc/inc/scresid.hxx index e7bdb167ca5d..5a63bd809fb5 100644 --- a/sc/inc/scresid.hxx +++ b/sc/inc/scresid.hxx @@ -24,6 +24,7 @@ #include "scdllapi.h" OUString SC_DLLPUBLIC ScResId(const char* pId); +OUString SC_DLLPUBLIC ScResId(const char* pId, int nCardinality); #endif // SC_SCRESMGR_HXX diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index 17916a1ab5ba..dc606e3bd379 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -21,6 +21,7 @@ #define INCLUDED_SC_INC_STRINGS_HRC #define NC_(Context, String) (Context "\004" u8##String) +#define NNC_(Context, StringSingular, StringPlural) (Context "\004" u8##StringSingular "\004" u8##StringPlural) // Strings for interface names ------------------------------------------- @@ -49,7 +50,7 @@ #define SCSTR_RENAMEOBJECT NC_("SCSTR_RENAMEOBJECT", "Name Object") #define STR_INSERTGRAPHIC NC_("STR_INSERTGRAPHIC", "Insert Image") #define STR_QUERYROTATION NC_("STR_QUERYROTATION", "This image is rotated. Would you like to rotate it into standard orientation?") -#define SCSTR_TOTAL NC_("SCSTR_TOTAL", "%1 results found") +#define SCSTR_TOTAL NNC_("SCSTR_TOTAL", "1 result found", "%1 results found") #define SCSTR_SKIPPED NC_("SCSTR_SKIPPED", "(only %1 are listed)") // Attribute #define SCSTR_PROTECTDOC NC_("SCSTR_PROTECTDOC", "Protect Spreadsheet Structure") diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index 406a0eac4c34..435cb6fa1549 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -113,6 +113,11 @@ OUString ScResId(const char* pId) return Translate::get(pId, SC_MOD()->GetResLocale()); } +OUString ScResId(const char* pId, int nCardinality) +{ + return Translate::nget(pId, nCardinality, SC_MOD()->GetResLocale()); +} + void ScDLL::Init() { if ( SfxApplication::GetModule(SfxToolsModule::Calc) ) // Module already active diff --git a/sc/source/ui/dialogs/searchresults.cxx b/sc/source/ui/dialogs/searchresults.cxx index 38facd11121b..436e0ec0ab99 100644 --- a/sc/source/ui/dialogs/searchresults.cxx +++ b/sc/source/ui/dialogs/searchresults.cxx @@ -26,7 +26,6 @@ namespace sc { SearchResultsDlg::SearchResultsDlg( SfxBindings* _pBindings, vcl::Window* pParent ) : ModelessDialog(pParent, "SearchResultsDialog", "modules/scalc/ui/searchresults.ui"), aSkipped( ScResId( SCSTR_SKIPPED ) ), - aTotal( ScResId( SCSTR_TOTAL ) ), mpBindings(_pBindings), mpDoc(nullptr) { get(mpSearchResults, "lbSearchResults"); @@ -148,7 +147,8 @@ void SearchResultsDlg::FillResults( ScDocument* pDoc, const ScRangeList &rMatche } } - OUString aSearchResults = ScGlobal::ReplaceOrAppend( aTotal, "%1", OUString::number( aList.mnCount ) ); + OUString aTotal(ScResId(SCSTR_TOTAL, aList.mnCount)); + OUString aSearchResults = aTotal.replaceFirst("%1", OUString::number(aList.mnCount)); if (aList.mnCount > ListWrapper::mnMaximum) aSearchResults += " " + ScGlobal::ReplaceOrAppend( aSkipped, "%1", OUString::number( ListWrapper::mnMaximum ) ); mpSearchResults->SetText(aSearchResults); diff --git a/sc/source/ui/inc/searchresults.hxx b/sc/source/ui/inc/searchresults.hxx index f07cc19ce5df..c50a12225727 100644 --- a/sc/source/ui/inc/searchresults.hxx +++ b/sc/source/ui/inc/searchresults.hxx @@ -25,7 +25,6 @@ class SearchResultsDlg : public ModelessDialog VclPtr<SvSimpleTable> mpList; VclPtr<FixedText> mpSearchResults; OUString aSkipped; - OUString aTotal; SfxBindings* mpBindings; ScDocument* mpDoc; |