* Remove the CatalogStub class and put the Gatcatalog function directly in BLocaleRoster,

* Adjust the B_TRANSLATE macros to take this into account
 * Adjust collectkatkeys to take it into account too
Thanks to Ingo for explaining me all the technical details about hiding things in shared objects.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37616 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues
2010-07-20 11:38:34 +00:00
parent 75e29683b2
commit fe8d7c0225
5 changed files with 40 additions and 57 deletions
+5 -22
View File
@@ -5,6 +5,7 @@
#ifndef _CATALOG_H_
#define _CATALOG_H_
#include <LocaleRoster.h>
#include <SupportDefs.h>
#include <String.h>
@@ -53,24 +54,6 @@ class BCatalog {
};
// Proxy class for handling a "shared object local" catalog.
// This must be included (statically linked) into each shared object needing
// a catalog on its own (application, add-on, library, ...). The shared object
// must also have a mimetype so that the catalog can be identified.
class BCatalogStub
{
private:
static BCatalog sCatalog;
static vint32 sCatalogInitOnce;
public:
static BCatalog* GetCatalog();
static void ForceReload();
// Use this to force re-initialisation of the catalog (when there
// is a locale change for example)
};
#ifndef B_AVOID_TRANSLATION_MACROS
// macros for easy catalog-access, define B_AVOID_TRANSLATION_MACROS if
// you don't want these:
@@ -97,19 +80,19 @@ class BCatalogStub
// Translation macros which may be used to shorten translation requests:
#undef B_TRANSLATE
#define B_TRANSLATE(str) \
BCatalogStub::GetCatalog()->GetString((str), B_TRANSLATE_CONTEXT)
be_locale_roster->GetCatalog()->GetString((str), B_TRANSLATE_CONTEXT)
#undef B_TRANSLATE_COMMENT
#define B_TRANSLATE_COMMENT(str, cmt) \
BCatalogStub::GetCatalog()->GetString((str), B_TRANSLATE_CONTEXT, (cmt))
be_locale_roster->GetCatalog()->GetString((str), B_TRANSLATE_CONTEXT, (cmt))
#undef B_TRANSLATE_ALL
#define B_TRANSLATE_ALL(str, ctx, cmt) \
BCatalogStub::GetCatalog()->GetString((str), (ctx), (cmt))
be_locale_roster->GetCatalog()->GetString((str), (ctx), (cmt))
#undef B_TRANSLATE_ID
#define B_TRANSLATE_ID(id) \
BCatalogStub::GetCatalog()->GetString((id))
be_locale_roster->GetCatalog()->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):
+4
View File
@@ -57,6 +57,10 @@ class BLocaleRoster {
const char* langPattern = NULL, int32 fingerprint = 0) const;
// the message contains...
BCatalog* GetCatalog();
// Get the catalog for the calling image (that needs to link with
// liblocalestub.a)
static const char *kCatLangAttr;
static const char *kCatSigAttr;
static const char *kCatFingerprintAttr;