[Libreoffice-commits] core.git: l10ntools/source

Zolnai Tamás zolnaitamas2000 at gmail.com
Sun Mar 31 13:11:34 PDT 2013


 l10ntools/source/cfgmerge.cxx |   59 +-----------------------------------------
 l10ntools/source/helper.cxx   |    3 ++
 2 files changed, 5 insertions(+), 57 deletions(-)

New commits:
commit c4745302f3bf6e9d4f94033391979deb8437c788
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date:   Sun Mar 31 22:10:05 2013 +0200

    There is no <Arg> tag in xcu localizable strings
    
    So no reason to work with it.
    So can use helper function after
    make it to handle single quote.
    
    Change-Id: Ic2eb901148c3ae31316607b41350bbad79a639db

diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx
index fd9474a..0aa53f8 100644
--- a/l10ntools/source/cfgmerge.cxx
+++ b/l10ntools/source/cfgmerge.cxx
@@ -84,61 +84,6 @@ void workOnTokenSet(int nTyp, char * pTokenText) {
 
 }
 
-namespace
-{
-
-static OString lcl_QuoteHTML( const OString& rString )
-{
-    rtl::OStringBuffer sReturn;
-    for ( sal_Int32 i = 0; i < rString.getLength(); i++ ) {
-        rtl::OString sTemp = rString.copy( i );
-        if ( sTemp.match( "<Arg n=" ) ) {
-            while ( i < rString.getLength() && rString[i] != '>' ) {
-                 sReturn.append(rString[i]);
-                i++;
-            }
-            if ( rString[i] == '>' ) {
-                sReturn.append('>');
-                i++;
-            }
-        }
-        if ( i < rString.getLength()) {
-            switch ( rString[i]) {
-                case '<':
-                    sReturn.append("<");
-                break;
-
-                case '>':
-                    sReturn.append(">");
-                break;
-
-                case '\"':
-                    sReturn.append(""");
-                break;
-
-                case '\'':
-                    sReturn.append("'");
-                break;
-
-                case '&':
-                    if ((( i + 4 ) < rString.getLength()) &&
-                        ( rString.copy( i, 5 ) == "&" ))
-                            sReturn.append(rString[i]);
-                    else
-                        sReturn.append("&");
-                break;
-
-                default:
-                    sReturn.append(rString[i]);
-                break;
-            }
-        }
-    }
-    return sReturn.makeStringAndClear();
-}
-
-} // anonymous namespace
-
 //
 // class CfgStackData
 //
@@ -558,7 +503,7 @@ void CfgMerge::WorkOnText(rtl::OString &rText, const rtl::OString& rLangIndex)
             if ( !rLangIndex.equalsIgnoreAsciiCase("en-US") &&
                 ( sContent != "-" ) && !sContent.isEmpty())
             {
-                rText = lcl_QuoteHTML( rText );
+                rText = helper::QuotHTML( rText );
             }
         }
     }
@@ -590,7 +535,7 @@ void CfgMerge::WorkOnResourceEnd()
                     ( sContent != "-" ) && !sContent.isEmpty())
                 {
 
-                    rtl::OString sText = lcl_QuoteHTML( sContent);
+                    rtl::OString sText = helper::QuotHTML( sContent);
 
                     rtl::OString sAdditionalLine( "\t" );
 
diff --git a/l10ntools/source/helper.cxx b/l10ntools/source/helper.cxx
index 08a2560..69163d0 100644
--- a/l10ntools/source/helper.cxx
+++ b/l10ntools/source/helper.cxx
@@ -27,6 +27,9 @@ OString QuotHTML(const OString &rString)
         case '"':
             sReturn.append(""");
             break;
+        case '\'':
+            sReturn.append("'");
+            break;
         case '&':
             if (rString.match("&", i))
                 sReturn.append('&');


More information about the Libreoffice-commits mailing list