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