xref: /haiku/headers/os/locale/LocaleRoster.h (revision 702526b17f11858618c2a037dd25da57af48a4de)
196eaa02eSAxel Dörfler /*
2*702526b1SAxel 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 
985366cb5SJonas Sundström #include <Entry.h>
10c3ac87e8SOliver Tappe #include <String.h>
11c3ac87e8SOliver Tappe 
1275f15221SOliver Tappe 
13d1d8fda6SOliver Tappe class BBitmap;
1438ac8defSOliver Tappe class BCatalog;
15c3ac87e8SOliver Tappe class BCollator;
16c3ac87e8SOliver Tappe class BCountry;
176fd2f4a0SOliver Tappe class BFormattingConventions;
1838ac8defSOliver Tappe class BLanguage;
1938ac8defSOliver Tappe class BLocale;
20f9a80fecSAxel Dörfler class BMessage;
214ae5a452SAdrien Destugues class BTimeZone;
22c3ac87e8SOliver Tappe 
234b37c7f8SAdrien Destugues 
24c3ac87e8SOliver Tappe enum {
25c3ac87e8SOliver Tappe 	B_LOCALE_CHANGED = '_LCC',
26c3ac87e8SOliver Tappe };
27c3ac87e8SOliver Tappe 
2875f15221SOliver Tappe 
29723383c0SOliver Tappe class BLocaleRoster {
30c3ac87e8SOliver Tappe public:
31c3ac87e8SOliver Tappe 								BLocaleRoster();
32c3ac87e8SOliver Tappe 								~BLocaleRoster();
33c3ac87e8SOliver Tappe 
3425dc253dSIngo Weinhold 	static	BLocaleRoster*		Default();
3525dc253dSIngo Weinhold 
3638ac8defSOliver Tappe 			status_t			GetDefaultTimeZone(BTimeZone* timezone) const;
374ae5a452SAdrien Destugues 
3838ac8defSOliver Tappe 			status_t			GetLanguage(const char* languageCode,
3938ac8defSOliver Tappe 									BLanguage** _language) const;
40c3ac87e8SOliver Tappe 
4138ac8defSOliver Tappe 			status_t			GetPreferredLanguages(BMessage* message) const;
425570fd11SAdrien Destugues 
436f43fabaSOliver Tappe 			status_t			GetAvailableLanguages(BMessage* message) const;
44c91aa9f4SOliver Tappe 			status_t			GetAvailableCountries(
45c91aa9f4SOliver Tappe 									BMessage* timeZones) const;
46c91aa9f4SOliver Tappe 			status_t			GetAvailableTimeZones(
47c91aa9f4SOliver Tappe 									BMessage* timeZones) const;
48c91aa9f4SOliver Tappe 			status_t			GetAvailableTimeZonesForCountry(
49c91aa9f4SOliver Tappe 									BMessage* message,
50c91aa9f4SOliver Tappe 									const char* countryCode) const;
51c3ac87e8SOliver Tappe 
52d1d8fda6SOliver Tappe 			status_t			GetFlagIconForCountry(BBitmap* flagIcon,
53d1d8fda6SOliver Tappe 									const char* countryCode);
54*702526b1SAxel Dörfler 			status_t			GetFlagIconForLanguage(BBitmap* flagIcon,
55*702526b1SAxel Dörfler 									const char* languageCode);
56d1d8fda6SOliver Tappe 
576fd2f4a0SOliver Tappe 			status_t			GetAvailableCatalogs(BMessage* message,
5838ac8defSOliver Tappe 									const char* sigPattern = NULL,
5938ac8defSOliver Tappe 									const char* langPattern = NULL,
6038ac8defSOliver Tappe 									int32 fingerprint = 0) const;
61c3ac87e8SOliver Tappe 									// the message contains...
62c3ac87e8SOliver Tappe 
6338ac8defSOliver Tappe 			status_t			Refresh();
6438ac8defSOliver Tappe 									// Refresh the internal data from the
6538ac8defSOliver Tappe 									// settings file(s)
6638ac8defSOliver Tappe 
67fe8d7c02SAdrien Destugues 			BCatalog*			GetCatalog();
6838ac8defSOliver Tappe 									// Get the catalog for the calling image
6938ac8defSOliver Tappe 									// (that needs to link with liblocalestub.a)
70fe8d7c02SAdrien Destugues 
7107cffb47SJonas Sundström 			bool				IsFilesystemTranslationPreferred() const;
7207cffb47SJonas Sundström 
73ee6a2e55SJonas Sundström 			status_t			GetLocalizedFileName(BString& localizedFileName,
74ee6a2e55SJonas Sundström 									const entry_ref& ref,
7585366cb5SJonas Sundström 									bool traverse = false);
7685366cb5SJonas Sundström 
77c3ac87e8SOliver Tappe 	static	const char*			kCatLangAttr;
78c3ac87e8SOliver Tappe 	static	const char*			kCatSigAttr;
79c3ac87e8SOliver Tappe 	static	const char*			kCatFingerprintAttr;
8075f15221SOliver Tappe 
81c3ac87e8SOliver Tappe 	static	const char*			kEmbeddedCatAttr;
82c3ac87e8SOliver Tappe 	static	int32				kEmbeddedCatResId;
83c3ac87e8SOliver Tappe 
84c3ac87e8SOliver Tappe private:
8538ac8defSOliver Tappe 	static	BCatalog*			_GetCatalog(BCatalog* catalog,
8638ac8defSOliver Tappe 									vint32* catalogInitStatus);
87ee6a2e55SJonas Sundström 
88ee6a2e55SJonas Sundström 			status_t			_PrepareCatalogEntry(const entry_ref& ref,
89ee6a2e55SJonas Sundström 									BString& signature, BString& context,
90ee6a2e55SJonas Sundström 									BString& string, bool traverse);
91c3ac87e8SOliver Tappe };
92c3ac87e8SOliver Tappe 
9338ac8defSOliver Tappe 
9438ac8defSOliver Tappe #endif	// _LOCALE_ROSTER_H_
95