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


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41167 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe 2011-04-02 13:37:59 +00:00
parent 017d6353fb
commit 2a06b5bdba
5 changed files with 20 additions and 11 deletions

View File

@ -44,6 +44,8 @@ class DefaultCatalog : public BHashMapCatalog {
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);

View File

@ -128,12 +128,8 @@ main(int argc, char **argv)
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();
}
}

View File

@ -146,6 +146,13 @@ DefaultCatalog::~DefaultCatalog()
}
status_t
DefaultCatalog::SetRawString(const CatKey& key, const char *translated)
{
return fCatMap.Put(key, translated);
}
status_t
DefaultCatalog::ReadFromFile(const char *path)
{

View File

@ -107,6 +107,13 @@ DefaultCatalog::~DefaultCatalog()
}
status_t
DefaultCatalog::SetRawString(const CatKey& key, const char *translated)
{
return fCatMap.Put(key, translated);
}
status_t
DefaultCatalog::ReadFromFile(const char *path)
{

View File

@ -111,12 +111,9 @@ main(int argc, char **argv)
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();
}
}