[Libreoffice-commits] core.git: sc/inc sc/source sw/inc sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Oct 9 14:37:32 UTC 2018


 sc/inc/globstr.hrc                |    3 ++-
 sc/inc/strings.hrc                |    2 +-
 sc/source/core/data/attrib.cxx    |    2 +-
 sc/source/core/data/docpool.cxx   |    2 +-
 sw/inc/strings.hrc                |    5 +++--
 sw/inc/swtypes.hxx                |    1 +
 sw/source/core/undo/undel.cxx     |   12 ++++++------
 sw/source/uibase/app/swmodule.cxx |    5 +++++
 8 files changed, 20 insertions(+), 12 deletions(-)

New commits:
commit 2116f1d7932aa778afb14daf9cf5cd3df7b05fc1
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Oct 9 08:58:19 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Oct 9 16:37:10 2018 +0200

    add some more pluralized form examples
    
    Change-Id: I7163577fb43f28c8c9c138ebf3a9d36586247a32
    Reviewed-on: https://gerrit.libreoffice.org/61587
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 186ef461f8ab..88e059d3270f 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -21,6 +21,7 @@
 #define SC_GLOBSTR_HRC
 
 #define NC_(Context, String) (Context "\004" u8##String)
+#define NNC_(Context, StringSingular, StringPlural) (Context "\004" u8##StringSingular "\004" u8##StringPlural)
 
 /*
  * This file is reserved for string IDs of permanently loaded resident string
@@ -313,7 +314,7 @@
 #define STR_SCATTR_PAGE_SCALETO                 NC_("STR_SCATTR_PAGE_SCALETO", "Fit print range(s) to width/height")
 #define STR_SCATTR_PAGE_SCALE_WIDTH             NC_("STR_SCATTR_PAGE_SCALE_WIDTH", "Width")
 #define STR_SCATTR_PAGE_SCALE_HEIGHT            NC_("STR_SCATTR_PAGE_SCALE_HEIGHT", "Height")
-#define STR_SCATTR_PAGE_SCALE_PAGES             NC_("STR_SCATTR_PAGE_SCALE_PAGES", "%1 page(s)")
+#define STR_SCATTR_PAGE_SCALE_PAGES             NNC_("STR_SCATTR_PAGE_SCALE_PAGES", "One page", "%1 pages")
 #define STR_SCATTR_PAGE_SCALE_AUTO              NC_("STR_SCATTR_PAGE_SCALE_AUTO", "automatic")
 #define STR_DOC_STAT                            NC_("STR_DOC_STAT", "Statistics")
 #define STR_LINKERROR                           NC_("STR_LINKERROR", "The link could not be updated.")
diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc
index dc606e3bd379..faaf973452a3 100644
--- a/sc/inc/strings.hrc
+++ b/sc/inc/strings.hrc
@@ -50,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                                 NNC_("SCSTR_TOTAL", "1 result found", "%1 results found")
+#define SCSTR_TOTAL                                 NNC_("SCSTR_TOTAL", "One 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/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx
index a537eb4e0250..769f9722725b 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -637,7 +637,7 @@ void lclAppendScalePageCount( OUString& rText, sal_uInt16 nPages )
     rText += ": ";
     if( nPages )
     {
-        OUString aPages( ScResId( STR_SCATTR_PAGE_SCALE_PAGES ) );
+        OUString aPages(ScResId(STR_SCATTR_PAGE_SCALE_PAGES, nPages));
         rText += aPages.replaceFirst( "%1", OUString::number( nPages ) );
     }
     else
diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx
index f199e49a26e2..965d3cf27d0b 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -536,7 +536,7 @@ bool ScDocumentPool::GetPresentation(
             if( nPagNo )
             {
                 rText = ScResId( STR_SCATTR_PAGE_SCALETOPAGES ) + aStrSep;
-                OUString aPages( ScResId( STR_SCATTR_PAGE_SCALE_PAGES ) );
+                OUString aPages(ScResId(STR_SCATTR_PAGE_SCALE_PAGES, nPagNo));
                 aPages = aPages.replaceFirst( "%1", OUString::number( nPagNo ) );
                 rText += aPages;
             }
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 7a35d1ebe1d2..7bb76458a3b6 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -21,6 +21,7 @@
 #define INCLUDED_SW_INC_STRINGS_HRC
 
 #define NC_(Context, String) (Context "\004" u8##String)
+#define NNC_(Context, StringSingular, StringPlural) (Context "\004" u8##StringSingular "\004" u8##StringPlural)
 
 // Format names
 #define STR_POOLCHR_FOOTNOTE                    NC_("STR_POOLCHR_FOOTNOTE", "Footnote Characters")
@@ -464,8 +465,8 @@
 #define STR_PASTE_CLIPBOARD_UNDO                NC_("STR_PASTE_CLIPBOARD_UNDO", "Paste clipboard")
 #define STR_YIELDS                              NC_("STR_YIELDS", "→")
 #define STR_OCCURRENCES_OF                      NC_("STR_OCCURRENCES_OF", "occurrences of")
-#define STR_UNDO_TABS                           NC_("STR_UNDO_TABS", "$1 tab(s)")
-#define STR_UNDO_NLS                            NC_("STR_UNDO_NLS", "$1 line break(s)")
+#define STR_UNDO_TABS                           NNC_("STR_UNDO_TABS", "One tab", "$1 tabs")
+#define STR_UNDO_NLS                            NNC_("STR_UNDO_NLS", "One line break","$1 line breaks")
 #define STR_UNDO_PAGEBREAKS                     NC_("STR_UNDO_PAGEBREAKS", "page break")
 #define STR_UNDO_COLBRKS                        NC_("STR_UNDO_COLBRKS", "column break")
 #define STR_UNDO_REDLINE_INSERT                 NC_("STR_UNDO_REDLINE_INSERT", "Insert $1")
diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx
index d2ce6af47540..1b1c88d28523 100644
--- a/sw/inc/swtypes.hxx
+++ b/sw/inc/swtypes.hxx
@@ -124,6 +124,7 @@ const short lOutlineMinTextDistance = 216; // 0.15 inch = 0.38 cm
 
 // defined in sw/source/uibase/app/swmodule.cxx
 SW_DLLPUBLIC OUString SwResId(const char* pId);
+SW_DLLPUBLIC OUString SwResId(const char* pId, int nCardinality);
 
 css::uno::Reference< css::linguistic2::XSpellChecker1 > GetSpellChecker();
 css::uno::Reference< css::linguistic2::XHyphenator >    GetHyphenator();
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 3f27ada19883..950349c54fda 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -658,7 +658,8 @@ static OUString lcl_DenotedPortion(const OUString& rStr, sal_Int32 nStart, sal_I
 {
     OUString aResult;
 
-    if (nEnd - nStart > 0)
+    auto nCount = nEnd - nStart;
+    if (nCount > 0)
     {
         sal_Unicode cLast = rStr[nEnd - 1];
         if (lcl_IsSpecialCharacter(cLast))
@@ -666,11 +667,11 @@ static OUString lcl_DenotedPortion(const OUString& rStr, sal_Int32 nStart, sal_I
             switch(cLast)
             {
             case CH_TXTATR_TAB:
-                aResult = SwResId(STR_UNDO_TABS);
+                aResult = SwResId(STR_UNDO_TABS, nCount);
 
                 break;
             case CH_TXTATR_NEWLINE:
-                aResult = SwResId(STR_UNDO_NLS);
+                aResult = SwResId(STR_UNDO_NLS, nCount);
 
                 break;
 
@@ -691,14 +692,13 @@ static OUString lcl_DenotedPortion(const OUString& rStr, sal_Int32 nStart, sal_I
                 break;
             }
             SwRewriter aRewriter;
-            aRewriter.AddRule(UndoArg1,
-                              OUString::number(nEnd - nStart));
+            aRewriter.AddRule(UndoArg1, OUString::number(nCount));
             aResult = aRewriter.Apply(aResult);
         }
         else
         {
             aResult = SwResId(STR_START_QUOTE);
-            aResult += rStr.copy(nStart, nEnd - nStart);
+            aResult += rStr.copy(nStart, nCount);
             aResult += SwResId(STR_END_QUOTE);
         }
     }
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index c186f1999fca..481750bf433c 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -201,6 +201,11 @@ OUString SwResId(const char* pId)
     return Translate::get(pId, SW_MOD()->GetResLocale());
 }
 
+OUString SwResId(const char* pId, int nCardinality)
+{
+    return Translate::nget(pId, nCardinality, SW_MOD()->GetResLocale());
+}
+
 uno::Reference< scanner::XScannerManager2 > const &
 SwModule::GetScannerManager()
 {


More information about the Libreoffice-commits mailing list