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