locale kit: allow creating a catalog without entry_ref
The catalogs are loaded from separate files, so there is no need to have an app entry_ref to load them, just a MIME type is enough. The implementation is a bit simplified: only the default catalog format is allowed (unlike when loading from entry_ref, where extra catalog formats can be added in add-ons). Unrelated cleanup: remove unused code to load catalogs from attributes of an application. We considered this when designing the locale kit, but using resources or separate files works better. Use this in Cortex, where some strings are in a static library, so they don't have an associated executable or library or add-on to identify them. The code in Cortex is not complete localization, several parts should use StringForRate, BStringFormat, etc. Change-Id: I09be22b1f50891250c4497c51e1db8dcee279140 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3172 Reviewed-by: Kacper Kasper <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
5c5a5dbbcc
commit
41853a8bbf
@@ -24,6 +24,9 @@ public:
|
||||
BCatalog(const entry_ref& catalogOwner,
|
||||
const char* language = NULL,
|
||||
uint32 fingerprint = 0);
|
||||
BCatalog(const char* signature,
|
||||
const char* language = NULL);
|
||||
|
||||
virtual ~BCatalog();
|
||||
|
||||
const char* GetString(const char* string,
|
||||
@@ -41,6 +44,8 @@ public:
|
||||
status_t SetTo(const entry_ref& catalogOwner,
|
||||
const char* language = NULL,
|
||||
uint32 fingerprint = 0);
|
||||
status_t SetTo(const char* signature,
|
||||
const char* language = NULL);
|
||||
|
||||
status_t InitCheck() const;
|
||||
int32 CountItems() const;
|
||||
|
||||
@@ -37,12 +37,12 @@ class DefaultCatalog : public HashMapCatalog {
|
||||
|
||||
// implementation for editor-interface:
|
||||
status_t ReadFromFile(const char *path = NULL);
|
||||
status_t ReadFromAttribute(const entry_ref &appOrAddOnRef);
|
||||
status_t ReadFromResource(const entry_ref &appOrAddOnRef);
|
||||
status_t WriteToFile(const char *path = NULL);
|
||||
status_t WriteToAttribute(const entry_ref &appOrAddOnRef);
|
||||
status_t WriteToResource(const entry_ref &appOrAddOnRef);
|
||||
|
||||
status_t ReadFromStandardLocations();
|
||||
|
||||
status_t SetRawString(const CatKey& key, const char *translated);
|
||||
void SetSignature(const entry_ref &catalogOwner);
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@ public:
|
||||
BCatalogData* LoadCatalog(const entry_ref& catalogOwner,
|
||||
const char* language = NULL,
|
||||
int32 fingerprint = 0) const;
|
||||
BCatalogData* LoadCatalog(const char* signature,
|
||||
const char* language = NULL) const;
|
||||
status_t UnloadCatalog(BCatalogData* catalogData);
|
||||
|
||||
BCatalogData* CreateCatalog(const char* type,
|
||||
|
||||
Reference in New Issue
Block a user