[haiku-commits] r41167 - in haiku/trunk: headers/private/locale src/bin/locale src/kits/locale src/tools/locale

Author: zooey
Date: 2011-04-02 15:37:59 +0200 (Sat, 02 Apr 2011)
New Revision: 41167
Changeset: https://dev.haiku-os.org/changeset/41167
Ticket: https://dev.haiku-os.org/ticket/6721

Modified:
   haiku/trunk/headers/private/locale/DefaultCatalog.h
   haiku/trunk/src/bin/locale/linkcatkeys.cpp
   haiku/trunk/src/kits/locale/DefaultCatalog.cpp
   haiku/trunk/src/tools/locale/DefaultCatalog.cpp
   haiku/trunk/src/tools/locale/linkcatkeys.cpp
Log:
Closing #6721: avoid unescaping when linking catalogs together
* add SetRawString() to both implementations of DefaultCatalog which sets
  the translated string as given
* use SetRawString() in both (standard- and build-)versions of linkcatkeys


Modified: haiku/trunk/headers/private/locale/DefaultCatalog.h
===================================================================
--- haiku/trunk/headers/private/locale/DefaultCatalog.h 2011-04-02 04:31:00 UTC 
(rev 41166)
+++ haiku/trunk/headers/private/locale/DefaultCatalog.h 2011-04-02 13:37:59 UTC 
(rev 41167)
@@ -44,6 +44,8 @@
                status_t WriteToAttribute(entry_ref *appOrAddOnRef);
                status_t WriteToResource(entry_ref *appOrAddOnRef);
 
+               status_t SetRawString(const CatKey& key, const char 
*translated);
+
                static BCatalogAddOn *Instantiate(const char *signature,
                        const char *language, uint32 fingerprint);
                static BCatalogAddOn *InstantiateEmbedded(entry_ref 
*appOrAddOnRef);

Modified: haiku/trunk/src/bin/locale/linkcatkeys.cpp
===================================================================
--- haiku/trunk/src/bin/locale/linkcatkeys.cpp  2011-04-02 04:31:00 UTC (rev 
41166)
+++ haiku/trunk/src/bin/locale/linkcatkeys.cpp  2011-04-02 13:37:59 UTC (rev 
41167)
@@ -128,12 +128,8 @@
                        const CatKey fixedCatKey(keyString.String(), 
keyComment.String(),
                                        keyContext.String());
 
-                       BString translatedString = walker.GetValue();
-
-                       if (!targetCatImpl->GetString(fixedCatKey)) {
-                               targetCatImpl->SetString(fixedCatKey,
-                                       translatedString.String());
-                       }
+                       if (!targetCatImpl->GetString(fixedCatKey))
+                               targetCatImpl->SetRawString(fixedCatKey, 
walker.GetValue());
                        walker.Next();
                }
        }

Modified: haiku/trunk/src/kits/locale/DefaultCatalog.cpp
===================================================================
--- haiku/trunk/src/kits/locale/DefaultCatalog.cpp      2011-04-02 04:31:00 UTC 
(rev 41166)
+++ haiku/trunk/src/kits/locale/DefaultCatalog.cpp      2011-04-02 13:37:59 UTC 
(rev 41167)
@@ -147,6 +147,13 @@
 
 
 status_t
+DefaultCatalog::SetRawString(const CatKey& key, const char *translated)
+{
+       return fCatMap.Put(key, translated);
+}
+
+
+status_t
 DefaultCatalog::ReadFromFile(const char *path)
 {
        if (!path)

Modified: haiku/trunk/src/tools/locale/DefaultCatalog.cpp
===================================================================
--- haiku/trunk/src/tools/locale/DefaultCatalog.cpp     2011-04-02 04:31:00 UTC 
(rev 41166)
+++ haiku/trunk/src/tools/locale/DefaultCatalog.cpp     2011-04-02 13:37:59 UTC 
(rev 41167)
@@ -108,6 +108,13 @@
 
 
 status_t
+DefaultCatalog::SetRawString(const CatKey& key, const char *translated)
+{
+       return fCatMap.Put(key, translated);
+}
+
+
+status_t
 DefaultCatalog::ReadFromFile(const char *path)
 {
        if (!path)

Modified: haiku/trunk/src/tools/locale/linkcatkeys.cpp
===================================================================
--- haiku/trunk/src/tools/locale/linkcatkeys.cpp        2011-04-02 04:31:00 UTC 
(rev 41166)
+++ haiku/trunk/src/tools/locale/linkcatkeys.cpp        2011-04-02 13:37:59 UTC 
(rev 41167)
@@ -111,12 +111,9 @@
                BHashMapCatalog::CatWalker walker(&inputCatalog);
                while (!walker.AtEnd()) {
                        const CatKey &key(walker.GetKey());
-                       BString translatedString = walker.GetValue();
 
-                       if (!targetCatImpl.GetString(key)) {
-                               targetCatImpl.SetString(key,
-                                       translatedString.String());
-                       }
+                       if (!targetCatImpl.GetString(key))
+                               targetCatImpl.SetRawString(key, 
walker.GetValue());
                        walker.Next();
                }
        }


Other related posts:

  • » [haiku-commits] r41167 - in haiku/trunk: headers/private/locale src/bin/locale src/kits/locale src/tools/locale - zooey