196eaa02eSAxel Dörfler /* 2702526b1SAxel Dörfler * Copyright 2003-2011, Haiku. All rights reserved. 396eaa02eSAxel Dörfler * Distributed under the terms of the MIT license. 496eaa02eSAxel Dörfler */ 5c3ac87e8SOliver Tappe #ifndef _LOCALE_ROSTER_H_ 6c3ac87e8SOliver Tappe #define _LOCALE_ROSTER_H_ 7c3ac87e8SOliver Tappe 875f15221SOliver Tappe 9*fed5e612SAdrien Destugues #include <pthread.h> 10*fed5e612SAdrien Destugues 1185366cb5SJonas Sundström #include <Entry.h> 12c3ac87e8SOliver Tappe #include <String.h> 13c3ac87e8SOliver Tappe 1475f15221SOliver Tappe 15d1d8fda6SOliver Tappe class BBitmap; 1638ac8defSOliver Tappe class BCatalog; 17c3ac87e8SOliver Tappe class BCollator; 18c3ac87e8SOliver Tappe class BCountry; 196fd2f4a0SOliver Tappe class BFormattingConventions; 2038ac8defSOliver Tappe class BLanguage; 2138ac8defSOliver Tappe class BLocale; 22f9a80fecSAxel Dörfler class BMessage; 234ae5a452SAdrien Destugues class BTimeZone; 24c3ac87e8SOliver Tappe 254b37c7f8SAdrien Destugues 2652cdfde0SOliver Tappe namespace BPrivate { 2752cdfde0SOliver Tappe class LocaleRosterData; 2852cdfde0SOliver Tappe } 2952cdfde0SOliver Tappe 3052cdfde0SOliver Tappe 31c3ac87e8SOliver Tappe enum { 32c3ac87e8SOliver Tappe B_LOCALE_CHANGED = '_LCC', 33c3ac87e8SOliver Tappe }; 34c3ac87e8SOliver Tappe 3575f15221SOliver Tappe 36723383c0SOliver Tappe class BLocaleRoster { 3752cdfde0SOliver Tappe 38c3ac87e8SOliver Tappe public: 39c3ac87e8SOliver Tappe ~BLocaleRoster(); 40c3ac87e8SOliver Tappe 4125dc253dSIngo Weinhold static BLocaleRoster* Default(); 4225dc253dSIngo Weinhold 4338ac8defSOliver Tappe status_t GetDefaultTimeZone(BTimeZone* timezone) const; 444ae5a452SAdrien Destugues 4538ac8defSOliver Tappe status_t GetLanguage(const char* languageCode, 4638ac8defSOliver Tappe BLanguage** _language) const; 47c3ac87e8SOliver Tappe 4838ac8defSOliver Tappe status_t GetPreferredLanguages(BMessage* message) const; 495570fd11SAdrien Destugues 506f43fabaSOliver Tappe status_t GetAvailableLanguages(BMessage* message) const; 51c91aa9f4SOliver Tappe status_t GetAvailableCountries( 52c91aa9f4SOliver Tappe BMessage* timeZones) const; 53c91aa9f4SOliver Tappe status_t GetAvailableTimeZones( 54c91aa9f4SOliver Tappe BMessage* timeZones) const; 55635df643SOliver Tappe status_t GetAvailableTimeZonesWithRegionInfo( 56635df643SOliver Tappe BMessage* timeZonesWithRegonInfo) const; 57c91aa9f4SOliver Tappe status_t GetAvailableTimeZonesForCountry( 58c91aa9f4SOliver Tappe BMessage* message, 59c91aa9f4SOliver Tappe const char* countryCode) const; 60c3ac87e8SOliver Tappe 61d1d8fda6SOliver Tappe status_t GetFlagIconForCountry(BBitmap* flagIcon, 62d1d8fda6SOliver Tappe const char* countryCode); 63702526b1SAxel Dörfler status_t GetFlagIconForLanguage(BBitmap* flagIcon, 64702526b1SAxel Dörfler const char* languageCode); 65d1d8fda6SOliver Tappe 666fd2f4a0SOliver Tappe status_t GetAvailableCatalogs(BMessage* message, 6738ac8defSOliver Tappe const char* sigPattern = NULL, 6838ac8defSOliver Tappe const char* langPattern = NULL, 6938ac8defSOliver Tappe int32 fingerprint = 0) const; 70c3ac87e8SOliver Tappe // the message contains... 71c3ac87e8SOliver Tappe 7238ac8defSOliver Tappe status_t Refresh(); 7338ac8defSOliver Tappe // Refresh the internal data from the 7438ac8defSOliver Tappe // settings file(s) 7538ac8defSOliver Tappe 76fe8d7c02SAdrien Destugues BCatalog* GetCatalog(); 7738ac8defSOliver Tappe // Get the catalog for the calling image 7838ac8defSOliver Tappe // (that needs to link with liblocalestub.a) 79fe8d7c02SAdrien Destugues 8052cdfde0SOliver Tappe const BLocale* GetDefaultLocale() const; 8152cdfde0SOliver Tappe 8207cffb47SJonas Sundström bool IsFilesystemTranslationPreferred() const; 8307cffb47SJonas Sundström 84ee6a2e55SJonas Sundström status_t GetLocalizedFileName(BString& localizedFileName, 85ee6a2e55SJonas Sundström const entry_ref& ref, 8685366cb5SJonas Sundström bool traverse = false); 8785366cb5SJonas Sundström 88c3ac87e8SOliver Tappe static const char* kCatLangAttr; 89c3ac87e8SOliver Tappe static const char* kCatSigAttr; 90c3ac87e8SOliver Tappe static const char* kCatFingerprintAttr; 9175f15221SOliver Tappe 92c3ac87e8SOliver Tappe static const char* kEmbeddedCatAttr; 93c3ac87e8SOliver Tappe static int32 kEmbeddedCatResId; 94c3ac87e8SOliver Tappe 9552cdfde0SOliver Tappe protected: 9652cdfde0SOliver Tappe BLocaleRoster(); 9752cdfde0SOliver Tappe 9852cdfde0SOliver Tappe protected: 9952cdfde0SOliver Tappe BPrivate::LocaleRosterData* fData; 10052cdfde0SOliver Tappe 101c3ac87e8SOliver Tappe private: 10238ac8defSOliver Tappe static BCatalog* _GetCatalog(BCatalog* catalog, 103*fed5e612SAdrien Destugues int32* catalogInitStatus); 104ee6a2e55SJonas Sundström 105ee6a2e55SJonas Sundström status_t _PrepareCatalogEntry(const entry_ref& ref, 106ee6a2e55SJonas Sundström BString& signature, BString& context, 107ee6a2e55SJonas Sundström BString& string, bool traverse); 10852cdfde0SOliver Tappe 109c3ac87e8SOliver Tappe }; 110c3ac87e8SOliver Tappe 11138ac8defSOliver Tappe 11238ac8defSOliver Tappe #endif // _LOCALE_ROSTER_H_ 113