From 96949a0a8d8ba26783f158d7b04db8840ebbcd0f Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Thu, 6 May 2010 15:42:48 +0000 Subject: [PATCH] Relating to #5408 * Added secondary macros, B_TRANSLATE* to replace TR* * For new localization patches, please use the newer B_TRANSLATE* * B_TRANSLATE* and TR* are functional during the transition to the new macros * Autmatic whitespace cleanup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36658 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/locale/Catalog.h | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/headers/os/locale/Catalog.h b/headers/os/locale/Catalog.h index b353b16642..e35d785ea6 100644 --- a/headers/os/locale/Catalog.h +++ b/headers/os/locale/Catalog.h @@ -1,4 +1,4 @@ -/* +/* * Copyright 2003-2009, Haiku, Inc. * Distributed under the terms of the MIT License. */ @@ -83,19 +83,26 @@ extern BCatalog* be_app_catalog; #undef TR #define TR(str) \ be_catalog->GetString((str), TR_CONTEXT) +#define B_TRANSLATE(str) \ + be_catalog->GetString((str), TR_CONTEXT) #undef TR_CMT #define TR_CMT(str, cmt) \ be_catalog->GetString((str), TR_CONTEXT, (cmt)) +#define B_TRANSLATE_COMMENT(str, cmt) \ + be_catalog->GetString((str), TR_CONTEXT, (cmt)) #undef TR_ALL #define TR_ALL(str, ctx, cmt) \ be_catalog->GetString((str), (ctx), (cmt)) +#define B_TRANSLATE_ALL(str, ctx, cmt) \ + be_catalog->GetString((str), (ctx), (cmt)) #undef TR_ID #define TR_ID(id) \ be_catalog->GetString((id)) - +#define B_TRANSLATE_ID(id) \ + be_catalog->GetString((id)) // Translation markers which can be used to mark static strings/IDs which // are used as key for translation requests (at other places in the code): @@ -123,18 +130,26 @@ extern BCatalog* be_app_catalog; #undef TR_MARK #define TR_MARK(str) \ BCatalogAddOn::MarkForTranslation((str), TR_CONTEXT, "") +#define B_TRANSLATE_MARK(str) \ + BCatalogAddOn::MarkForTranslation((str), TR_CONTEXT, "") #undef TR_MARK_CMT #define TR_MARK_CMT(str, cmt) \ BCatalogAddOn::MarkForTranslation((str), TR_CONTEXT, (cmt)) +#define B_TRANSLATE_MARK_COMMENT(str, cmt) \ + BCatalogAddOn::MarkForTranslation((str), TR_CONTEXT, (cmt)) #undef TR_MARK_ALL #define TR_MARK_ALL(str, ctx, cmt) \ BCatalogAddOn::MarkForTranslation((str), (ctx), (cmt)) +#define B_TRANSLATE_MARK_ALL(str, ctx, cmt) \ + BCatalogAddOn::MarkForTranslation((str), (ctx), (cmt)) #undef TR_MARK_ID #define TR_MARK_ID(id) \ BCatalogAddOn::MarkForTranslation((id)) +#define B_TRANSLATE_MARK_ID(id) \ + BCatalogAddOn::MarkForTranslation((id)) #endif /* B_AVOID_TRANSLATION_MACROS */ @@ -170,18 +185,18 @@ class BCatalogAddOn { const char *context = NULL, const char *comment = NULL); virtual status_t SetString(int32 id, const char *translated); - + virtual bool CanWriteData() const; virtual status_t SetData(const char *name, BMessage *msg); virtual status_t SetData(uint32 id, BMessage *msg); - + virtual status_t ReadFromFile(const char *path = NULL); virtual status_t ReadFromAttribute(entry_ref *appOrAddOnRef); virtual status_t ReadFromResource(entry_ref *appOrAddOnRef); virtual status_t WriteToFile(const char *path = NULL); virtual status_t WriteToAttribute(entry_ref *appOrAddOnRef); virtual status_t WriteToResource(entry_ref *appOrAddOnRef); - + virtual void MakeEmpty(); virtual int32 CountItems() const; @@ -324,18 +339,18 @@ class EditableCatalog : public BCatalog { const char *context = NULL, const char *comment = NULL); status_t SetString(int32 id, const char *translated); - + bool CanWriteData() const; status_t SetData(const char *name, BMessage *msg); status_t SetData(uint32 id, BMessage *msg); - + status_t ReadFromFile(const char *path = NULL); status_t ReadFromAttribute(entry_ref *appOrAddOnRef); status_t ReadFromResource(entry_ref *appOrAddOnRef); status_t WriteToFile(const char *path = NULL); status_t WriteToAttribute(entry_ref *appOrAddOnRef); status_t WriteToResource(entry_ref *appOrAddOnRef); - + void MakeEmpty(); private: