xref: /haiku/headers/os/locale/LocaleRoster.h (revision 362efe0c9f36d3dd38b22d2c24ac02e54b189d7c)
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 enum {
25 	B_LOCALE_CHANGED = '_LCC',
26 };
27 
28 
29 class BLocaleRoster {
30 public:
31 								BLocaleRoster();
32 								~BLocaleRoster();
33 
34 	static	BLocaleRoster*		Default();
35 
36 			status_t			GetDefaultTimeZone(BTimeZone* timezone) const;
37 
38 			status_t			GetLanguage(const char* languageCode,
39 									BLanguage** _language) const;
40 
41 			status_t			GetPreferredLanguages(BMessage* message) const;
42 
43 			status_t			GetAvailableLanguages(BMessage* message) const;
44 			status_t			GetAvailableCountries(
45 									BMessage* timeZones) const;
46 			status_t			GetAvailableTimeZones(
47 									BMessage* timeZones) const;
48 			status_t			GetAvailableTimeZonesForCountry(
49 									BMessage* message,
50 									const char* countryCode) const;
51 
52 			status_t			GetFlagIconForCountry(BBitmap* flagIcon,
53 									const char* countryCode);
54 			status_t			GetFlagIconForLanguage(BBitmap* flagIcon,
55 									const char* languageCode);
56 
57 			status_t			GetAvailableCatalogs(BMessage* message,
58 									const char* sigPattern = NULL,
59 									const char* langPattern = NULL,
60 									int32 fingerprint = 0) const;
61 									// the message contains...
62 
63 			status_t			Refresh();
64 									// Refresh the internal data from the
65 									// settings file(s)
66 
67 			BCatalog*			GetCatalog();
68 									// Get the catalog for the calling image
69 									// (that needs to link with liblocalestub.a)
70 
71 			bool				IsFilesystemTranslationPreferred() const;
72 
73 			status_t			GetLocalizedFileName(BString& localizedFileName,
74 									const entry_ref& ref,
75 									bool traverse = false);
76 
77 	static	const char*			kCatLangAttr;
78 	static	const char*			kCatSigAttr;
79 	static	const char*			kCatFingerprintAttr;
80 
81 	static	const char*			kEmbeddedCatAttr;
82 	static	int32				kEmbeddedCatResId;
83 
84 private:
85 	static	BCatalog*			_GetCatalog(BCatalog* catalog,
86 									vint32* catalogInitStatus);
87 
88 			status_t			_PrepareCatalogEntry(const entry_ref& ref,
89 									BString& signature, BString& context,
90 									BString& string, bool traverse);
91 };
92 
93 
94 #endif	// _LOCALE_ROSTER_H_
95