1 /* 2 * Copyright 2003-2011, Haiku. All rights reserved. 3 * Distributed under the terms of the MIT license. 4 */ 5 #ifndef _LOCALE_ROSTER_H_ 6 #define _LOCALE_ROSTER_H_ 7 8 9 #include <pthread.h> 10 11 #include <Entry.h> 12 #include <String.h> 13 14 15 class BBitmap; 16 class BCatalog; 17 class BCollator; 18 class BCountry; 19 class BFormattingConventions; 20 class BLanguage; 21 class BLocale; 22 class BMessage; 23 class BTimeZone; 24 25 26 namespace BPrivate { 27 class LocaleRosterData; 28 } 29 30 31 enum { 32 B_LOCALE_CHANGED = '_LCC', 33 }; 34 35 36 class BLocaleRoster { 37 38 public: 39 ~BLocaleRoster(); 40 41 static BLocaleRoster* Default(); 42 43 status_t GetDefaultTimeZone(BTimeZone* timezone) const; 44 45 status_t GetLanguage(const char* languageCode, 46 BLanguage** _language) const; 47 48 status_t GetPreferredLanguages(BMessage* message) const; 49 50 status_t GetAvailableLanguages(BMessage* message) const; 51 status_t GetAvailableCountries( 52 BMessage* timeZones) const; 53 status_t GetAvailableTimeZones( 54 BMessage* timeZones) const; 55 status_t GetAvailableTimeZonesWithRegionInfo( 56 BMessage* timeZonesWithRegonInfo) const; 57 status_t GetAvailableTimeZonesForCountry( 58 BMessage* message, 59 const char* countryCode) const; 60 61 status_t GetFlagIconForCountry(BBitmap* flagIcon, 62 const char* countryCode); 63 status_t GetFlagIconForLanguage(BBitmap* flagIcon, 64 const char* languageCode); 65 66 status_t GetAvailableCatalogs(BMessage* message, 67 const char* sigPattern = NULL, 68 const char* langPattern = NULL, 69 int32 fingerprint = 0) const; 70 // the message contains... 71 72 status_t Refresh(); 73 // Refresh the internal data from the 74 // settings file(s) 75 76 BCatalog* GetCatalog(); 77 // Get the catalog for the calling image 78 // (that needs to link with liblocalestub.a) 79 80 const BLocale* GetDefaultLocale() const; 81 82 bool IsFilesystemTranslationPreferred() const; 83 84 status_t GetLocalizedFileName(BString& localizedFileName, 85 const entry_ref& ref, 86 bool traverse = false); 87 88 static const char* kCatLangAttr; 89 static const char* kCatSigAttr; 90 static const char* kCatFingerprintAttr; 91 92 static const char* kEmbeddedCatAttr; 93 static int32 kEmbeddedCatResId; 94 95 protected: 96 BLocaleRoster(); 97 98 protected: 99 BPrivate::LocaleRosterData* fData; 100 101 private: 102 static BCatalog* _GetCatalog(BCatalog* catalog, 103 int32* catalogInitStatus); 104 105 status_t _PrepareCatalogEntry(const entry_ref& ref, 106 BString& signature, BString& context, 107 BString& string, bool traverse); 108 109 }; 110 111 112 #endif // _LOCALE_ROSTER_H_ 113